[LTP] [PATCH] ioctl_ficlone03: fix capabilities on immutable files

Andrea Cervesato andrea.cervesato@suse.de
Wed Mar 26 13:42:51 CET 2025


From: Andrea Cervesato <andrea.cervesato@suse.com>

Make sure that capabilities requirements are satisfied when accessing
immutable files. On OpenSUSE Tumbleweed 32bit bcachefs fails with the
following error due to missing capabilities:

tst_test.c:1833: TINFO: === Testing on bcachefs ===
..
ioctl_ficlone03.c:74: TBROK: ioctl .. failed: ENOTTY (25)
ioctl_ficlone03.c:89: TWARN: ioctl ..  failed: ENOTTY (25)
ioctl_ficlone03.c:91: TWARN: ioctl ..  failed: ENOTTY (25)
ioctl_ficlone03.c:98: TWARN: close(-1) failed: EBADF (9)

Introduce CAP_LINUX_IMMUTABLE capability to make sure that test won't
fail on other systems as well.

Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
 testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
index 6a9d270d9fb56f3a263f0aed976f62c4576e6a5f..6716423d9c96d9fc1d433f28e0ae1511b912ae2c 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl_ficlone03.c
@@ -122,5 +122,9 @@ static struct tst_test test = {
 	.bufs = (struct tst_buffers []) {
 		{&clone_range, .size = sizeof(struct file_clone_range)},
 		{},
-	}
+	},
+	.caps = (struct tst_cap []) {
+		TST_CAP(TST_CAP_REQ, CAP_LINUX_IMMUTABLE),
+		{}
+	},
 };

---
base-commit: 753bd13472d4be44eb70ff183b007fe9c5fffa07
change-id: 20250326-fix_ioctl_ficlone03_32bit_bcachefs-2ec15bd6c0c6

Best regards,
-- 
Andrea Cervesato <andrea.cervesato@suse.com>



More information about the ltp mailing list