From 3ec74b96b7e82877c03a7d0fb4c81a296b923013 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 6 Aug 2025 12:41:01 +0100 Subject: [PATCH] seccomp: fix build with glibc < 2.39 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../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 --- src/shared/seccomp-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/seccomp-util.c b/src/shared/seccomp-util.c index 53d18dada5..f5bd64f8d3 100644 --- a/src/shared/seccomp-util.c +++ b/src/shared/seccomp-util.c @@ -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 #include #include #include