diff options
| -rw-r--r-- | cmd/ioworkload/scenario_mountfs.go | 7 | ||||
| -rw-r--r-- | integrationtests/mountfs_test.go | 3 |
2 files changed, 9 insertions, 1 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) diff --git a/integrationtests/mountfs_test.go b/integrationtests/mountfs_test.go index ff783e7..673e9c1 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,fsmount,pivot_root,quotactl,statmount,listmount,listns,swapon,swapoff", + "mount,umount,move_mount,fsopen,fsmount,pivot_root,quotactl,statmount,listmount,listns,swapon,swapoff", } func TestMountFsManagementSyscalls(t *testing.T) { @@ -12,6 +12,7 @@ func TestMountFsManagementSyscalls(t *testing.T) { {Tracepoint: "enter_mount", MinCount: 1}, {Tracepoint: "enter_umount", MinCount: 1}, {Tracepoint: "enter_move_mount", MinCount: 1}, + {Tracepoint: "enter_fsopen", MinCount: 1}, {Tracepoint: "enter_fsmount", MinCount: 1}, {Tracepoint: "enter_pivot_root", MinCount: 1}, {Tracepoint: "enter_quotactl", MinCount: 1}, |
