From 90180f4d8755e5425af122ce9d4c4e07f0464a9a Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Wed, 11 Nov 2026 17:35:44 +0100 Subject: [PATCH] Sandbox: build on riscv64, where libc names no kexec_file_load (#3777) The seccomp list named libc::SYS_kexec_file_load, which libc (0.2.190) defines for x86_64 and aarch64 but not riscv64, so the release's Linux riscv64 build stopped with E0425. riscv64 takes the number from the kernel's generic table, 294, as aarch64 does; the test checks libc's aarch64 value against it. --- crates/sandbox/src/linux.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/sandbox/src/linux.rs b/crates/sandbox/src/linux.rs index aaeff2647..9866e034f 100644 --- a/crates/sandbox/src/linux.rs +++ b/crates/sandbox/src/linux.rs @@ -31,6 +31,12 @@ const SYS_SETXATTRAT: libc::c_long = 463; const SYS_REMOVEXATTRAT: libc::c_long = 466; const SYS_OPEN_TREE_ATTR: libc::c_long = 467; const SYS_FILE_SETATTR: libc::c_long = 469; +// `libc` names no kexec_file_load on riscv64 (0.2.190). It takes 294 from the kernel's generic +// table there, as on aarch64, where `libc` names it. +#[cfg(target_arch = "riscv64")] +const SYS_KEXEC_FILE_LOAD: libc::c_long = 294; +#[cfg(not(target_arch = "riscv64"))] +const SYS_KEXEC_FILE_LOAD: libc::c_long = libc::SYS_kexec_file_load; pub fn support() -> Support { match arch() { @@ -223,7 +229,7 @@ fn denied_calls() -> Vec { libc::SYS_finit_module, libc::SYS_delete_module, libc::SYS_kexec_load, - libc::SYS_kexec_file_load, + SYS_KEXEC_FILE_LOAD, libc::SYS_swapon, libc::SYS_swapoff, libc::SYS_reboot, @@ -455,6 +461,9 @@ mod tests { #[cfg(target_arch = "x86_64")] assert_eq!(SYS_FCHMODAT2, libc::SYS_fchmodat2); assert_eq!((SYS_SETXATTRAT, SYS_REMOVEXATTRAT, SYS_OPEN_TREE_ATTR, SYS_FILE_SETATTR), (463, 466, 467, 469)); + // The generic table's number, which riscv64 writes here, is the one `libc` gives aarch64. + #[cfg(target_arch = "aarch64")] + assert_eq!(libc::SYS_kexec_file_load, 294); } #[test]