summaryrefslogtreecommitdiff
path: root/integrationtests/mountfs_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-09 22:28:33 +0300
committerPaul Buetow <paul@buetow.org>2026-06-09 22:28:33 +0300
commitd33d2ef1186096dddf2836f83e91b833866ef3bd (patch)
tree2155f579b7d42d5ad1487d99c211508e28af4938 /integrationtests/mountfs_test.go
parentf601dc90fcef3f270c55a9612c5f0326dbd0f391 (diff)
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 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/mountfs_test.go')
-rw-r--r--integrationtests/mountfs_test.go8
1 files changed, 7 insertions, 1 deletions
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},