From 83dccd9cbca41454a2e5e5a8da5606e7bfc3a013 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 20 Aug 2024 03:33:41 -0300 Subject: [PATCH] build: fix undeclared AUDIT_ARCH_AARCH64 on Linux <3.17 It apparently only exists since Linux kernel version 3.17 (in linux/audit.h)[1]. Partial build log: ../include/seccomp.h:114:25: error: 'AUDIT_ARCH_AARCH64' undeclared (first use in this function); did you mean 'AUDIT_ARCH_SPARC64'? 114 | # define ARCH_NR AUDIT_ARCH_AARCH64 | ^~~~~~~~~~~~~~~~~~ ../include/seccomp.h:198:38: note: in expansion of macro 'ARCH_NR' 198 | BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ARCH_NR, 1, 0), \ | ^~~~~~~ sbox.c:113:25: note: in expansion of macro 'VALIDATE_ARCHITECTURE' 113 | VALIDATE_ARCHITECTURE, | ^~~~~~~~~~~~~~~~~~~~~ ../include/seccomp.h:114:25: note: each undeclared identifier is reported only once for each function it appears in 114 | # define ARCH_NR AUDIT_ARCH_AARCH64 | ^~~~~~~~~~~~~~~~~~ ../include/seccomp.h:198:38: note: in expansion of macro 'ARCH_NR' 198 | BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, ARCH_NR, 1, 0), \ | ^~~~~~~ sbox.c:113:25: note: in expansion of macro 'VALIDATE_ARCHITECTURE' 113 | VALIDATE_ARCHITECTURE, | ^~~~~~~~~~~~~~~~~~~~~ Environment: Linux kernel/headers 3.10 / CentOS 7 / arm64. Fixes #6440. [1] https://github.com/torvalds/linux/commit/875cbf3e4614cfdcc7f65033e25292aec80f09c0 Reported-by: @snakethatlovesstaticlibs --- src/include/seccomp.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/include/seccomp.h b/src/include/seccomp.h index 089b8e2ff87..ee490283bbc 100644 --- a/src/include/seccomp.h +++ b/src/include/seccomp.h @@ -101,6 +101,11 @@ #define SECCOMP_RET_LOG 0x7ffc0000U #endif +// Note: AUDIT_ARCH_AARCH64 only exists since Linux 3.17; see #6440 and +// https://github.com/torvalds/linux/commit/875cbf3e4614cfdcc7f65033e25292aec80f09c0 +#ifndef AUDIT_ARCH_AARCH64 +#define AUDIT_ARCH_AARCH64 (EM_AARCH64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) +#endif #if defined(__i386__) # define ARCH_NR AUDIT_ARCH_I386