From 39292704fbed6ebb6eb88101ad8d09167cbd1959 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Sat, 21 Nov 2026 09:29:21 +0100 Subject: [PATCH] ufat: fix the rename tests on aarch64 a_failure_after_the_image_got_its_name_syncs_its_directory() fails on the aarch64 runners: /tmp/ufat-named-4319/a.img is complete and has its name, but syncing its directory failed: Input/output error (os error 5) The test makes the rename of the file written next to the image fail with a seccomp filter, so the filter has to refuse the system call that glibc renames with. glibc uses renameat() wherever the kernel has it. I assumed aarch64 doesn't have it but it does. It's system call 38 there and glibc's renameat() and rename() both use it. It's riscv64 and loongarch64 that only have renameat2(). So on aarch64 we refused renameat2(), the rename went through renameat() and succeeded, and the only failure left was the sync of the image's directory. Refuse renameat() on aarch64 too. While at it, let an_output_that_cannot_replace_leaves_no_temporary_name() run on aarch64 as well. It was limited to x86_64 and x86 for the same reason. Fixes: 3882d9115b0d ("ufat: create new images with O_TMPFILE") Signed-off-by: Christian Brauner (Amutable) --- src/bin/ufat/util.rs | 4 ++-- tests/cli.rs | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bin/ufat/util.rs b/src/bin/ufat/util.rs index 38b6c09..e6a7fcf 100644 --- a/src/bin/ufat/util.rs +++ b/src/bin/ufat/util.rs @@ -1300,9 +1300,9 @@ mod tests { fn a_failure_after_the_image_got_its_name_syncs_its_directory() { // What a rename that may replace is: renameat() where there is one, // renameat2() without flags elsewhere. - #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] + #[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] const RENAME: libc::c_long = libc::SYS_renameat; - #[cfg(not(any(target_arch = "x86_64", target_arch = "x86")))] + #[cfg(not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64")))] const RENAME: libc::c_long = libc::SYS_renameat2; let dir = TempDir::new("named"); let (path, written) = (dir.0.join("a.img"), dir.0.join("a.manifest")); diff --git a/tests/cli.rs b/tests/cli.rs index 890bf87..810b2dd 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -2268,8 +2268,9 @@ impl Refused { errno: libc::EIO, }; /// Every renameat(), a rename that may replace, failing. glibc renames - /// with it on x86_64 and x86, where it is a system call of its own. - #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] + /// with it on x86_64, x86 and aarch64, where it is a system call of its + /// own. + #[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] const RENAME: Refused = Refused { call: libc::SYS_renameat, flag: None, @@ -2690,7 +2691,7 @@ fn assemble_in_a_directory_it_cannot_read() { /// A file written next to the image that cannot get its name, where the /// name exists and the rename onto it fails, takes its temporary name with /// it, also with O_TMPFILE. The image keeps its name. -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +#[cfg(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))] #[test] fn an_output_that_cannot_replace_leaves_no_temporary_name() { let _serial = common::serial();