summaryrefslogtreecommitdiff
path: root/internal/generate/family_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-29 22:32:55 +0300
committerPaul Buetow <paul@buetow.org>2026-05-29 22:32:55 +0300
commit18c8e8f5f3d7cc9bbbcb9b8b9be65477110363a7 (patch)
tree5a27462787e0591991558056fc3f152ca6bbe260 /internal/generate/family_test.go
parent5aadfad3a145de9967120065587d830f09ad87aa (diff)
test(generate): lock in access/faccessat path classification
Audit of access(2) found the tracing implementation already correct: FS family, KindPathname capturing the real path, and an UNCLASSIFIED int 0/-1 ret_event on exit. access(2) captures its path from args[0] (no dirfd), while siblings faccessat(2)/faccessat2(2) capture from args[1] (dfd precedes the path). mage generate produces no diff and the docs/integration coverage already match. Add unit lock-in tests mirroring prior syscall audits: - FormatAccess/FormatFaccessat tracepoint fixtures (real kernel formats). - classify tests asserting both classify as KindPathname/"filename". - family_test cluster asserting access/faccessat/faccessat2 stay FamilyFS. - codegen test proving access reads ctx->args[0] while faccessat reads ctx->args[1], guarding against a wrong-arg or dropped-path regression. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/generate/family_test.go')
-rw-r--r--internal/generate/family_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/generate/family_test.go b/internal/generate/family_test.go
index 47b7685..cba4f8e 100644
--- a/internal/generate/family_test.go
+++ b/internal/generate/family_test.go
@@ -59,6 +59,19 @@ func TestClassifySyscallFamily(t *testing.T) {
{"sys_exit_gettimeofday", FamilyTime},
{"sys_enter_sched_yield", FamilySched},
{"sys_enter_openat", FamilyFS},
+ // access(2) checks the calling process's permissions for a file named by
+ // a real filesystem path (pathname at args[0]; no dirfd). Its siblings
+ // faccessat(2)/faccessat2(2) perform the same check relative to a dirfd
+ // (path at args[1]). All three are filesystem-metadata syscalls and must
+ // stay in FamilyFS together — assert the whole cluster so a stray
+ // reclassification of any one trips this test. Keep in sync with the FS
+ // list in docs/syscall-tracing-plan.md.
+ {"sys_enter_access", FamilyFS},
+ {"sys_exit_access", FamilyFS},
+ {"sys_enter_faccessat", FamilyFS},
+ {"sys_exit_faccessat", FamilyFS},
+ {"sys_enter_faccessat2", FamilyFS},
+ {"sys_exit_faccessat2", FamilyFS},
// utime(2)/utimes(2) change a file's access and modification times by
// path (filename at args[0] is a real filesystem path, captured as
// KindPathname). They are filesystem-metadata syscalls and share