Conversation
Add LoongArch64 (EM_LOONGARCH 258) support to the audit library, following the pattern used by aarch64 and riscv. The LoongArch64 architecture uses the generic syscall ABI (same as riscv64), so the syscall table is derived from the riscv64 table minus RISC-V-specific syscalls. This includes: - configure.ac: --with-loongarch64 option and WITH_LOONGARCH64 define - lib/libaudit.h: MACH_LOONGARCH64 in machine_t enum - lib/libaudit.c: machine determination for loongarch64 (64-bit only) - lib/lookup_table.c: elf table entry and s2i/i2s dispatch - lib/machinetab.h: machine name mapping - lib/Makefile.am: build rules for loongarch64_tables.h - lib/test/lookup_test.c: table validation test - lib/syscall-update.txt: syscall source documentation - lib/loongarch64_table.h: 326 syscall entries (new file) Signed-off-by: YuPeng <yupeng@kylinos.cn>
Author
|
Hi @stevegrubb, friendly ping on this loongarch64 support PR. Summary of verification:
The approach follows the existing aarch64/riscv64 pattern with --with-loongarch64 Please let me know if any changes are needed. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds LoongArch64 processor support to the audit userspace library
(
libaudit), following the pattern established by aarch64 and riscv.The Linux kernel has had LoongArch64 support since 5.19. The kernel
headers (
linux/audit.h,elf.h) already defineEM_LOONGARCH(258)and
AUDIT_ARCH_LOONGARCH64, but audit-userspace does not map theseto a machine type. This patch closes that gap.
Why it matters
Without this patch,
audit_determine_machine()returns -4 forloongarch64andaudit_name_to_syscall()/audit_syscall_to_name()return nothing. Any audit tool that needs to translate between syscall
numbers and names —
ausyscall,aureport,ausearch— silentlyfails on a loongarch64 host.
A search of this repository's issues, PRs and git history returns
zero results for "loongarch" or "loongarch64". The gap is complete.
Scope
lib/loongarch64_table.h, 326 syscallentries)
audit_determine_machine()logic explicitly rejects 32-bit requestsriscv64_table.h(both use thegeneric ABI), minus two RISC-V-specific syscalls
--with-loongarch64configure flag, matching the--with-arm/--with-aarch64/--with-riscvconventionthese already exist in system kernel headers
Testing
#ifdef WITH_LOONGARCH64guarded blocks —a build without
--with-loongarch64is bit-identical to the unpatched treeFull native build (x86_64 host)
configurecorrectly definesWITH_LOONGARCH64in config.hmakesucceeds:loongarch64_table.h(326 entries) processed by gen_tables.c,producing 171-line lookup tables; 4 loongarch64 symbols linked into libaudit.so
lookup_testpasses: "Testing loongarch64_table..." runs without errorsCross-compilation (loongarch64 target)
Using loongarch64-unknown-linux-gnu-gcc 15.1.0 (from loongson/build-tools):
loongarch64_tables.h+ gen_tables.h helpers compile cleanlyfor loongarch64 target:
filereportsELF 64-bit LSB relocatable, LoongArchSyscall number spot-check