seccomp: fix build with glibc < 2.39

../src/shared/seccomp-util.c: In function ‘seccomp_restrict_sxid’:
../src/shared/seccomp-util.c:2228:25: error: ‘__NR_fchmodat2’ undeclared (first use in this function); did you mean ‘fchmodat2’?
 2228 |                         __NR_fchmodat2,
      |                         ^~~~~~~~~~~~~~
      |                         fchmodat2

The override/sys/syscalls.h needs to be included before the seccomp
headers, otherwise the internal seccomp preprocessor machinery will
not see the local definitions, so the local ifdef will be true but
the seccomp own definitions will be empty
This commit is contained in:
Luca Boccassi
2025-08-06 12:41:01 +01:00
parent 2793d6acf0
commit 3ec74b96b7

View File

@@ -1,5 +1,9 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/* This needs to be included before the seccomp headers, otherwise missing syscalls will be defined in this
* file and pass the ifdef, but they won't be defined in the seccomp headers so things like
* SCMP_SYS(fchmodat2) will resolve as empty and fail the build with older glibc/libseccomp. */
#include <sys/syscall.h>
#include <fcntl.h>
#include <linux/seccomp.h>
#include <sched.h>