]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/seccomp: skip pkey_mprotect protections if the syscall is unknown 7310/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Nov 2017 08:35:49 +0000 (09:35 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 13 Nov 2017 08:35:49 +0000 (09:35 +0100)
When compiling with an old kernel on architectures for which the
number is not defined in missing.h, a warning is generated in missing.h.
Let's just skip the protection in this case, to allow build to proceed.

src/shared/seccomp-util.c

index f8f757650b712200f6ada22d1416cf51338ccbcf..8b6184a778f015f4fe5d0f39ae9b5459e1e090e9 100644 (file)
@@ -1440,11 +1440,13 @@ int seccomp_memory_deny_write_execute(void) {
                 if (r < 0)
                         continue;
 
+#ifdef __NR_pkey_mprotect
                 r = add_seccomp_syscall_filter(seccomp, arch, SCMP_SYS(pkey_mprotect),
                                                1,
                                                SCMP_A2(SCMP_CMP_MASKED_EQ, PROT_EXEC, PROT_EXEC));
                 if (r < 0)
                         continue;
+#endif
 
                 if (shmat_syscall != 0) {
                         r = add_seccomp_syscall_filter(seccomp, arch, SCMP_SYS(shmat),