Browse Source

filter_seccomp: fix build on antique systems

Fixed build on systems that do not provide necessary definitions
of AUDIT_ARCH_* constants.

* filter_seccomp.c [PERSONALITY0_AUDIT_ARCH]: Include
"xlat/elf_em.h" and "xlat/audit_arch.h" under XLAT_MACROS_ONLY.
* tests/filter_seccomp-flag.c: Likewise.
* NEWS: Mention this fix.

Fixes: v5.3~7 "Introduce seccomp-assisted syscall filtering"
Dmitry V. Levin 1 month ago
parent
commit
1ce3ceb442
3 changed files with 20 additions and 2 deletions
  1. 2
    0
      NEWS
  2. 9
    1
      filter_seccomp.c
  3. 9
    1
      tests/filter_seccomp-flag.c

+ 2
- 0
NEWS View File

@@ -8,6 +8,8 @@ Noteworthy changes in release ?.? (????-??-??)
8 8
 * Bug fixes
9 9
   * Fixed -b execve when --seccomp-bpf option is specified.
10 10
   * Fixed build on no-MMU architectures.
11
+  * Fixed build on antique systems that do not provide necessary definitions
12
+    of AUDIT_ARCH_* constants.
11 13
 
12 14
 Noteworthy changes in release 5.3 (2019-09-25)
13 15
 ==============================================

+ 9
- 1
filter_seccomp.c View File

@@ -13,7 +13,6 @@
13 13
 #include <signal.h>
14 14
 #include <sys/prctl.h>
15 15
 #include <sys/wait.h>
16
-#include <linux/audit.h>
17 16
 #include <linux/filter.h>
18 17
 
19 18
 #include "filter_seccomp.h"
@@ -28,6 +27,15 @@ bool seccomp_before_sysentry;
28 27
 
29 28
 # include <linux/seccomp.h>
30 29
 
30
+/* PERSONALITY*_AUDIT_ARCH definitions depend on AUDIT_ARCH_* constants.  */
31
+# ifdef PERSONALITY0_AUDIT_ARCH
32
+#  include <linux/audit.h>
33
+#  define XLAT_MACROS_ONLY
34
+#   include "xlat/elf_em.h"
35
+#   include "xlat/audit_arch.h"
36
+#  undef XLAT_MACROS_ONLY
37
+# endif
38
+
31 39
 # ifndef BPF_MAXINSNS
32 40
 #  define BPF_MAXINSNS 4096
33 41
 # endif

+ 9
- 1
tests/filter_seccomp-flag.c View File

@@ -12,7 +12,15 @@
12 12
 #include "arch_defs.h"
13 13
 #include "sysent.h"
14 14
 #include "scno.h"
15
-#include <linux/audit.h>
15
+
16
+/* PERSONALITY*_AUDIT_ARCH definitions depend on AUDIT_ARCH_* constants.  */
17
+#ifdef PERSONALITY0_AUDIT_ARCH
18
+# include <linux/audit.h>
19
+# define XLAT_MACROS_ONLY
20
+#  include "xlat/elf_em.h"
21
+#  include "xlat/audit_arch.h"
22
+# undef XLAT_MACROS_ONLY
23
+#endif
16 24
 
17 25
 #ifdef __x86_64__
18 26
 # ifndef __X32_SYSCALL_BIT

Loading…
Cancel
Save