]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sys_linux: fix seccomp filter for BINDTODEVICE option
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 6 Oct 2021 08:02:34 +0000 (10:02 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 6 Oct 2021 08:09:35 +0000 (10:09 +0200)
The BINDTODEVICE socket option is the first option in the seccomp filter
setting a string instead of int. Remove the length check from the
setsockopt rules to allow a device name longer than 3 characters.

This was reported in Debian bug #995207.

Fixes: b9f5ce83b02e ("sys_linux: allow BINDTODEVICE option in seccomp filter")
sys_linux.c

index 8fba259e7e5b345b78eaf833d27c852498787734..9cab2efaa7b96ee3a0a4c7923575601af2619268 100644 (file)
@@ -739,10 +739,9 @@ SYS_Linux_EnableSystemCallFilter(int level, SYS_ProcessContext context)
 
     /* Allow selected socket options */
     for (i = 0; i < sizeof (socket_options) / sizeof (*socket_options); i++) {
-      if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt), 3,
+      if (seccomp_rule_add(ctx, SCMP_ACT_ALLOW, SCMP_SYS(setsockopt), 2,
                            SCMP_A1(SCMP_CMP_EQ, socket_options[i][0]),
-                           SCMP_A2(SCMP_CMP_EQ, socket_options[i][1]),
-                           SCMP_A4(SCMP_CMP_LE, sizeof (int))) < 0)
+                           SCMP_A2(SCMP_CMP_EQ, socket_options[i][1])))
         goto add_failed;
     }