From d33d2ef1186096dddf2836f83e91b833866ef3bd Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 9 Jun 2026 22:28:33 +0300 Subject: test: add mount_setattr coverage and assert vmsplice TRANSFER byte count mount_setattr(2) was the only new-mount-API sibling not exercised end-to-end (unlike move_mount/fsmount/fspick/open_tree), and vmsplice(2) had zero end-to-end assertion despite being TRANSFER_CLASSIFIED. uj0 (mount_setattr): add a best-effort RawSyscall6(SYS_MOUNT_SETATTR) call to mountfsManagement() aimed at the scenario mount point with AT_FDCWD and a MountAttr requesting MOUNT_ATTR_RDONLY. It needs CAP_SYS_ADMIN (Linux 5.12+) and the path is not a mount, so it returns EPERM/EINVAL, but its sys_enter_ tracepoint fires on kernel entry before any check -- the same best-effort pattern used for the other mount-API calls. Add mount_setattr to mountfsTraceArgs and assert enter_mount_setattr MinCount>=1 in TestMountFsManagementSyscalls. bl0 (vmsplice): add a deterministic retbytesVmsplice driver to the phase-A workload (mirroring the getdents64/readlinkat drivers): a spaced retry loop that gathers a fixed 18-byte user iovec into a fresh pipe via vmsplice and drains it each iteration. vmsplice is TRANSFER_CLASSIFIED, so the exit reports ctx->ret = bytes moved. Add vmsplice to retbytesTraceArgs and assert enter_vmsplice presence plus assertEventBytesAtLeast(payloadLen=18) and a positive duration in TestRetbytesPhaseA, locking in the TRANSFER byte attribution like its splice/tee siblings. Coverage hardening only; classification/tracing verified correct by inspection (mount_setattr=FamilyFS/KindPathname/UNCLASSIFIED, vmsplice=FamilyNetwork/KindFd/TRANSFER_CLASSIFIED). Verified: TEST_NAME=TestMountFsManagementSyscalls mage testWithName PASS (enter_mount_setattr captured); TEST_NAME=TestRetbytesPhaseA mage testWithName PASS (vmsplice bytes>=18 asserted). Co-Authored-By: Claude Opus 4.8 --- integrationtests/mountfs_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'integrationtests/mountfs_test.go') diff --git a/integrationtests/mountfs_test.go b/integrationtests/mountfs_test.go index 69a19fd..a32cda7 100644 --- a/integrationtests/mountfs_test.go +++ b/integrationtests/mountfs_test.go @@ -4,7 +4,7 @@ import "testing" var mountfsTraceArgs = []string{ "-trace-syscalls", - "mount,umount,move_mount,fsopen,fsconfig,fspick,open_tree,fsmount,pivot_root,quotactl,quotactl_fd,statmount,listmount,listns,swapon,swapoff", + "mount,umount,move_mount,fsopen,fsconfig,fspick,open_tree,mount_setattr,fsmount,pivot_root,quotactl,quotactl_fd,statmount,listmount,listns,swapon,swapoff", } func TestMountFsManagementSyscalls(t *testing.T) { @@ -20,6 +20,12 @@ func TestMountFsManagementSyscalls(t *testing.T) { {Tracepoint: "enter_fsconfig", MinCount: 1}, {Tracepoint: "enter_fspick", MinCount: 1}, {Tracepoint: "enter_open_tree", MinCount: 1}, + // mount_setattr (KindPathname, path@arg1) changes per-mount attributes + // of an existing mount and needs CAP_SYS_ADMIN (Linux 5.12+), so it + // returns EPERM/EINVAL in the scenario. Its sys_enter_ tracepoint fires + // on kernel entry regardless of permission/validity, so MinCount>=1 + // holds even though the call itself fails. + {Tracepoint: "enter_mount_setattr", MinCount: 1}, {Tracepoint: "enter_fsmount", MinCount: 1}, {Tracepoint: "enter_pivot_root", MinCount: 1}, {Tracepoint: "enter_quotactl", MinCount: 1}, -- cgit v1.2.3