diff options
Diffstat (limited to 'internal/generate')
| -rw-r--r-- | internal/generate/bpfhandler.go | 10 | ||||
| -rw-r--r-- | internal/generate/classify.go | 28 | ||||
| -rw-r--r-- | internal/generate/classify_test.go | 44 |
3 files changed, 82 insertions, 0 deletions
diff --git a/internal/generate/bpfhandler.go b/internal/generate/bpfhandler.go index 85377f1..fb4a4e3 100644 --- a/internal/generate/bpfhandler.go +++ b/internal/generate/bpfhandler.go @@ -262,6 +262,16 @@ func generateExtraEventfd(f *Format, isEnter bool) string { if isEnter { flagsExpr := "0" switch f.Name { + case "sys_enter_epoll_create": + flagsExpr = "(__s32)ctx->args[0]" + case "sys_enter_epoll_create1": + flagsExpr = "(__s32)ctx->args[0]" + case "sys_enter_inotify_init1": + flagsExpr = "(__s32)ctx->args[0]" + case "sys_enter_fanotify_init": + flagsExpr = "(__s32)ctx->args[0]" + case "sys_enter_landlock_create_ruleset": + flagsExpr = "(__s32)ctx->args[2]" case "sys_enter_eventfd2": flagsExpr = "(__s32)ctx->args[1]" case "sys_enter_memfd_create": diff --git a/internal/generate/classify.go b/internal/generate/classify.go index 69ada90..9896976 100644 --- a/internal/generate/classify.go +++ b/internal/generate/classify.go @@ -206,6 +206,34 @@ func classifyNameOnly(name string) (ClassificationResult, bool) { return ClassificationResult{Kind: KindEventfd}, true case "sys_exit_timerfd_create": return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_epoll_create": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_epoll_create": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_epoll_create1": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_epoll_create1": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_inotify_init": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_inotify_init": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_inotify_init1": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_inotify_init1": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_fanotify_init": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_fanotify_init": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_landlock_create_ruleset": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_landlock_create_ruleset": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_enter_fsopen": + return ClassificationResult{Kind: KindEventfd}, true + case "sys_exit_fsopen": + return ClassificationResult{Kind: KindEventfd}, true case "sys_enter_pidfd_open": return ClassificationResult{Kind: KindPidfd}, true case "sys_exit_pidfd_open": diff --git a/internal/generate/classify_test.go b/internal/generate/classify_test.go index 4b156ff..b51877c 100644 --- a/internal/generate/classify_test.go +++ b/internal/generate/classify_test.go @@ -654,6 +654,43 @@ func TestClassifyN7NameOnlyKinds(t *testing.T) { } } +func TestClassifyG7NameOnlyKinds(t *testing.T) { + tests := []struct { + name string + want TracepointKind + }{ + {"sys_enter_epoll_create", KindEventfd}, + {"sys_exit_epoll_create", KindEventfd}, + {"sys_enter_epoll_create1", KindEventfd}, + {"sys_exit_epoll_create1", KindEventfd}, + {"sys_enter_inotify_init", KindEventfd}, + {"sys_exit_inotify_init", KindEventfd}, + {"sys_enter_inotify_init1", KindEventfd}, + {"sys_exit_inotify_init1", KindEventfd}, + {"sys_enter_fanotify_init", KindEventfd}, + {"sys_exit_fanotify_init", KindEventfd}, + {"sys_enter_landlock_create_ruleset", KindEventfd}, + {"sys_exit_landlock_create_ruleset", KindEventfd}, + {"sys_enter_fsopen", KindEventfd}, + {"sys_exit_fsopen", KindEventfd}, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r := ClassifyFormat(&Format{ + Name: tt.name, + ExternalFields: []Field{ + {Type: "long", Name: "__syscall_nr"}, + {Type: "long", Name: "arg0"}, + }, + }) + if r.Kind != tt.want { + t.Fatalf("%s: got kind %d, want %d", tt.name, r.Kind, tt.want) + } + }) + } +} + func TestClassifyMount(t *testing.T) { r := classifyFromData(t, FormatMount) if r.Kind != KindPathname { @@ -819,6 +856,13 @@ func TestClassifySyscallPairAccepted(t *testing.T) { {"pipe2", FormatPipe2, FormatExitPipe2, KindPipe}, {"eventfd", FormatEventfd, FormatExitEventfd, KindEventfd}, {"eventfd2", FormatEventfd2, FormatExitEventfd2, KindEventfd}, + {"epoll_create", syntheticEnter("epoll_create", 9340), syntheticExit("epoll_create", 9339), KindEventfd}, + {"epoll_create1", syntheticEnter("epoll_create1", 9342), syntheticExit("epoll_create1", 9341), KindEventfd}, + {"inotify_init", syntheticEnter("inotify_init", 9344), syntheticExit("inotify_init", 9343), KindEventfd}, + {"inotify_init1", syntheticEnter("inotify_init1", 9346), syntheticExit("inotify_init1", 9345), KindEventfd}, + {"fanotify_init", syntheticEnter("fanotify_init", 9348), syntheticExit("fanotify_init", 9347), KindEventfd}, + {"landlock_create_ruleset", syntheticEnter("landlock_create_ruleset", 9350), syntheticExit("landlock_create_ruleset", 9349), KindEventfd}, + {"fsopen", syntheticEnter("fsopen", 9352), syntheticExit("fsopen", 9351), KindEventfd}, {"pidfd_open", syntheticEnter("pidfd_open", 9320), syntheticExit("pidfd_open", 9319), KindPidfd}, {"pidfd_send_signal", syntheticEnter("pidfd_send_signal", 9322), syntheticExit("pidfd_send_signal", 9321), KindFd}, {"epoll_ctl", FormatEpollCtl, FormatExitEpollCtl, KindEpollCtl}, |
