diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-29 17:01:57 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-29 17:01:57 +0300 |
| commit | fd8632e70dd2ec7dc6b0b03f469e3281114d5048 (patch) | |
| tree | ce2ea0f701e3f8bb2f93923a211044c0a7c64506 | |
| parent | d526d0a5f482a3b12675bd281683c58b23d9093c (diff) | |
test(generate): lock in set_mempolicy_home_node classification
Audit of the set_mempolicy_home_node(2) NUMA syscall (task mz) confirmed
it is correctly classified: KindNull (name-only, ior does not capture the
addr/len range), FamilyMemory (matching its siblings set_mempolicy, mbind,
migrate_pages, move_pages and docs/syscall-tracing-plan.md), and an
Unclassified return (0/-1 with no byte count).
Add lock-in tests so the classification cannot silently drift:
- family_test.go asserts FamilyMemory for set_mempolicy_home_node and its
NUMA siblings, with a note that get_mempolicy is the lone sibling still
on FamilySecurity (tracked separately, out of scope here).
- retclassify_test.go asserts the exit stays UNCLASSIFIED.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | internal/generate/family_test.go | 14 | ||||
| -rw-r--r-- | internal/generate/retclassify_test.go | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/internal/generate/family_test.go b/internal/generate/family_test.go index 08a601a..61718af 100644 --- a/internal/generate/family_test.go +++ b/internal/generate/family_test.go @@ -19,6 +19,20 @@ func TestClassifySyscallFamily(t *testing.T) { // FamilyIPC (where the pidfd_* lifecycle syscalls live). {"sys_enter_process_madvise", FamilyMemory}, {"sys_exit_process_madvise", FamilyMemory}, + // set_mempolicy_home_node(2) (Linux 5.17+) sets the home NUMA node for a + // memory range (start,len,home_node,flags); it returns 0/-1 with no byte + // count, so it is KindNull and Unclassified. It is a NUMA memory-policy + // syscall and shares FamilyMemory with its siblings set_mempolicy(2), + // mbind(2), migrate_pages(2), and move_pages(2). NOTE: get_mempolicy(2) is + // the one NUMA sibling currently classified FamilySecurity instead of + // FamilyMemory — that inconsistency is tracked separately and is out of + // scope for this set_mempolicy_home_node assertion. + {"sys_enter_set_mempolicy_home_node", FamilyMemory}, + {"sys_exit_set_mempolicy_home_node", FamilyMemory}, + {"sys_enter_set_mempolicy", FamilyMemory}, + {"sys_enter_mbind", FamilyMemory}, + {"sys_enter_migrate_pages", FamilyMemory}, + {"sys_enter_move_pages", FamilyMemory}, {"sys_enter_execve", FamilyProcess}, {"sys_enter_rt_sigaction", FamilySignals}, {"sys_enter_clock_gettime", FamilyTime}, diff --git a/internal/generate/retclassify_test.go b/internal/generate/retclassify_test.go index 3adae6e..70ade1a 100644 --- a/internal/generate/retclassify_test.go +++ b/internal/generate/retclassify_test.go @@ -51,6 +51,11 @@ func TestClassifyRetUnclassified(t *testing.T) { // sequences area; it transfers no bytes, so its exit must stay // UNCLASSIFIED (plain ret_event), like its KindNull siblings. "rseq", + // set_mempolicy_home_node(2) sets the home NUMA node for a memory range + // and returns int 0/-1 (no byte count), so its exit carries a plain + // ret_event and must stay UNCLASSIFIED, like its NUMA siblings + // set_mempolicy/mbind/migrate_pages/move_pages. + "set_mempolicy_home_node", } for _, name := range unclassified { if got := ClassifyRet("sys_exit_" + name); got != Unclassified { |
