Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: error: 'AUDIT_ARCH_AARCH64' undeclared on Linux <3.17 #6440

Open
snakethatlovesstaticlibs opened this issue Aug 20, 2024 · 0 comments
Labels
bug Something isn't working stale Closed due to inactivity

Comments

@snakethatlovesstaticlibs

Description

On

# define ARCH_32 AUDIT_ARCH_ARM
, firejail uses AUDIT_ARCH_AARCH64, however this symbol is only defined starting linux version 3.17: torvalds/linux@875cbf3 (see the Github tag views)

Steps to Reproduce

Try to build the latest version of firejail / seccomp on a platform with a kernel version of 3.10, see that it fails with:

../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,
      |                         ^~~~~~~~~~~~~~~~~~~~~

Additional context

  • This is probably not a showstopper for us, I am slightly concerned though that we need to use newer kernel header versions when targeting an older kernel version

Environment

  • Name/version/arch of the Linux kernel (e.g. the output of uname -srm) Kernel version 3.10
  • Name/version of the Linux distribution (e.g. "Ubuntu 20.04" or "Arch Linux") Centos 7
  • Name/version of the C compiler (e.g. "gcc 14.1.1-1") gcc-13
  • Name/version of the libc (e.g. "glibc 2.40-1") glibc 2.17
  • Version of the Linux API headers (e.g. "linux-api-headers 6.10-1" on Arch Linux) 3.10
  • Version of the source code being built (e.g. the output of git rev-parse HEAD) 0.9.72
@snakethatlovesstaticlibs snakethatlovesstaticlibs changed the title build: Usage of AUDIT_ARCH_AARCH64 prevents building from source on versions lower than 3.17 build: Usage of AUDIT_ARCH_AARCH64 prevents building from source on versions lower than Linux 3.17 Aug 20, 2024
@kmk3 kmk3 changed the title build: Usage of AUDIT_ARCH_AARCH64 prevents building from source on versions lower than Linux 3.17 build: error: 'AUDIT_ARCH_AARCH64' undeclared on Linux <3.17 Aug 20, 2024
@kmk3 kmk3 added the bug Something isn't working label Aug 20, 2024
kmk3 added a commit to kmk3/firejail that referenced this issue Aug 21, 2024
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 netblue30#6440.

[1] torvalds/linux@875cbf3

Reported-by: @snakethatlovesstaticlibs
@kmk3 kmk3 added the stale Closed due to inactivity label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working stale Closed due to inactivity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants