diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-09 22:09:13 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-09 22:09:13 +0300 |
| commit | 3cd5e655ee1768b4118815d1ea887acdd57eb498 (patch) | |
| tree | 05285bc148faff79f931059aff97b8d3fbb9b126 /integrationtests/pidfd_test.go | |
| parent | 57615945e6796950e7095a3ee8a97651ae3f1bd9 (diff) | |
test: add coverage for pidfd_send_signal and fadvise64
pidfd_send_signal (FamilyIPC, KindFd@arg0) and fadvise64 (KindFd,
UNCLASSIFIED fd-based hint) previously had no end-to-end integration
coverage despite correct classification/tracing.
pidfd_send_signal: add a pidfd-send-signal ioworkload scenario that
opens a pidfd for the current process and issues a sig-0 liveness probe
(delivers nothing, safe to target self) via syscall.Syscall6 with the
per-arch nr 424. TestPidfdSendSignal asserts enter_pidfd_send_signal is
captured; pidfd_send_signal added to the pidfd -trace-syscalls list.
fadvise64: add readwrite-fadvise64 and readwrite-fadvise64-ebadf
scenarios using unix.Fadvise(fd, 0, 0, FADV_NORMAL), mirroring the
readahead tests. TestReadwriteFadvise64 asserts enter_fadvise64 with
Bytes==0 (UNCLASSIFIED: offset/len are hints, not bytes transferred) and
positive duration; the ebadf variant asserts enter capture with Bytes==0
on the failing call.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'integrationtests/pidfd_test.go')
| -rw-r--r-- | integrationtests/pidfd_test.go | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/integrationtests/pidfd_test.go b/integrationtests/pidfd_test.go index 8df2e13..cbe671d 100644 --- a/integrationtests/pidfd_test.go +++ b/integrationtests/pidfd_test.go @@ -2,7 +2,7 @@ package integrationtests import "testing" -var pidfdTraceArgs = []string{"-trace-syscalls", "pidfd_open,pidfd_getfd,openat,write,close"} +var pidfdTraceArgs = []string{"-trace-syscalls", "pidfd_open,pidfd_getfd,pidfd_send_signal,openat,write,close"} // TestPidfdGetfdSuccess asserts the resolved path of the pidfd_getfd event is // the duplicated source file, NOT the pidfd's anon_inode. @@ -36,3 +36,18 @@ func TestPidfdGetfdFailure(t *testing.T) { }, }, pidfdTraceArgs) } + +// TestPidfdSendSignal asserts ior captures the enter_pidfd_send_signal +// tracepoint when ioworkload issues a pidfd_send_signal liveness probe (sig 0) +// against its own pidfd. The BPF enter handler captures args[0] = the pidfd +// (FamilyIPC, KindFd); the exit is UNCLASSIFIED. Signal 0 delivers nothing, so +// the probe is safe to target self. +func TestPidfdSendSignal(t *testing.T) { + runScenarioResultWithIorArgs(t, "pidfd-send-signal", []ExpectedEvent{ + { + Tracepoint: "enter_pidfd_send_signal", + Comm: "ioworkload", + MinCount: 1, + }, + }, pidfdTraceArgs) +} |
