diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-20 22:43:32 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-20 22:43:32 +0300 |
| commit | 6ca4d5ddacaff05d8bd82a5e9a6dfbb39ac111c9 (patch) | |
| tree | a0b4469a9eb96bfb0b5a09d5f086219782040982 /cmd/ioworkload/scenario_security_test.go | |
| parent | 7a9839917461b12c810329ccb8fd3c6de06902d2 (diff) | |
feat: add keyctl ptrace perf_event_open tracing (task 77)
Diffstat (limited to 'cmd/ioworkload/scenario_security_test.go')
| -rw-r--r-- | cmd/ioworkload/scenario_security_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/cmd/ioworkload/scenario_security_test.go b/cmd/ioworkload/scenario_security_test.go new file mode 100644 index 0000000..f1b6152 --- /dev/null +++ b/cmd/ioworkload/scenario_security_test.go @@ -0,0 +1,38 @@ +package main + +import "testing" + +func TestSecuritySyscallNumbers(t *testing.T) { + for _, tc := range []struct { + name string + arch string + wantErr bool + addKey uintptr + ptrace uintptr + perf uintptr + }{ + {name: "amd64", arch: "amd64", addKey: 248, ptrace: 101, perf: 298}, + {name: "arm64", arch: "arm64", addKey: 217, ptrace: 117, perf: 241}, + {name: "unsupported", arch: "riscv64", wantErr: true}, + } { + got, err := securitySyscallNumbers(tc.arch) + if tc.wantErr { + if err == nil { + t.Fatalf("%s: expected error", tc.name) + } + continue + } + if err != nil { + t.Fatalf("%s: unexpected error: %v", tc.name, err) + } + if got.addKey != tc.addKey || got.ptrace != tc.ptrace || got.perfEventOpen != tc.perf { + t.Fatalf( + "%s: unexpected numbers add_key=%d ptrace=%d perf_event_open=%d", + tc.name, + got.addKey, + got.ptrace, + got.perfEventOpen, + ) + } + } +} |
