Skip to content

Commit d1c2c9d

Browse files
committed
tetragon: Limit sys_close events in test
The TestKprobeMatchArgsFileEqual test (among others) uses the getMatchArgsFdCrd() function to generate a policy to track file descriptors and subsequent specific file actions happening to certain files. While the fd_install kprobe matches the file specifications provided, the sys_close kprobe (that unfollows the FD) does not. This results in vast amounts of sys_close events. When using the perf ring buffer, this did not cause test failures. With the BPF ring buffer, the tests can flake, however. This is due to the additional volume of events processed in user space (due to the increased efficiency of the BPF ring buffer), delaying the test events' arrival, and causing the test to give up before the test events have been observed. This commit adds the file specification to the sys_close selectors to reduce the number of additional events. Signed-off-by: Kevin Sheldrake <[email protected]>
1 parent 7f09bfd commit d1c2c9d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pkg/sensors/tracing/kprobe_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,9 +3336,17 @@ spec:
33363336
syscall: true
33373337
args:
33383338
- index: 0
3339-
type: "int"
3339+
type: "fd"
33403340
selectors:
3341-
- matchActions:
3341+
- matchArgs:
3342+
- index: 0
3343+
operator: "` + opStr + `"
3344+
values: `
3345+
for i := range vals {
3346+
configHook += fmt.Sprintf("\n - \"%s\"", vals[i])
3347+
}
3348+
configHook += "\n"
3349+
configHook += ` matchActions:
33423350
- action: UnfollowFD
33433351
argFd: 0
33443352
argName: 0

0 commit comments

Comments
 (0)