diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-31 10:21:57 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-31 10:21:57 +0300 |
| commit | 7e58a0df8b994e4a3a53aec88dc05fe7f1b079bf (patch) | |
| tree | 3487bc10b2aaa6676a203179127d70c93cfec673 /cmd | |
| parent | c6573c61435a23194087558378be3efc1a47fdc4 (diff) | |
test(mountfs): exercise fsopen end-to-end in mount-API scenario
The mountfs-management integration scenario covered the new mount API
syscalls fsmount/move_mount/mount/umount/pivot_root but not fsopen, the
API's entry point and a direct eventfd-kind sibling of fsmount. Add a
best-effort fsopen("tmpfs", FSOPEN_CLOEXEC) call (closing the returned
context fd on success) and assert enter_fsopen is traced.
fsopen's tracing is otherwise correct: args[1] flags captured, args[0]
fsname (a filesystem TYPE, not a path) deliberately not treated as a
pathname, returned fd registered as the 'fsopenfd:<flags>' descriptor.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/ioworkload/scenario_mountfs.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd/ioworkload/scenario_mountfs.go b/cmd/ioworkload/scenario_mountfs.go index 4c48ded..7aa8163 100644 --- a/cmd/ioworkload/scenario_mountfs.go +++ b/cmd/ioworkload/scenario_mountfs.go @@ -46,6 +46,13 @@ func mountfsManagement() error { // Best-effort coverage: these calls are expected to fail on most hosts // without CAP_SYS_ADMIN, but still exercise syscall tracing paths. + // fsopen(fsname, flags) is the entry point of the new mount API: it takes a + // filesystem TYPE name (e.g. "tmpfs"), NOT a path, in args[0] and the + // FSOPEN_CLOEXEC flag in args[1], returning a new filesystem-context fd. We + // close the returned fd when the call succeeds so we do not leak it. + if fd, _, errno := syscall.RawSyscall(unix.SYS_FSOPEN, uintptr(unsafe.Pointer(tmpfs)), uintptr(unix.FSOPEN_CLOEXEC), 0); errno == 0 { + _ = syscall.Close(int(fd)) + } _, _, _ = syscall.RawSyscall6(unix.SYS_MOUNT, uintptr(unsafe.Pointer(none)), uintptr(unsafe.Pointer(mountPath)), uintptr(unsafe.Pointer(tmpfs)), 0, 0, 0) _, _, _ = syscall.RawSyscall(unix.SYS_UMOUNT2, uintptr(unsafe.Pointer(mountPath)), 0, 0) _, _, _ = syscall.RawSyscall(unix.SYS_UMOUNT2, uintptr(unsafe.Pointer(mountPath)), uintptr(unix.MNT_DETACH), 0) |
