From c78920d55d58ff54ab4a6adbd425072963b7e8f9 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Fri, 29 May 2026 11:13:32 +0300 Subject: test(generate): lock in rseq family and return classification Audit of the rseq(2) syscall confirmed the existing classification is correct and consistent with its siblings: - KindNull: the rseq argument is a userspace struct pointer (not an fd or filesystem path), and args[2] flags are intentionally not captured, in line with the KindNull convention shared with set_robust_list and membarrier. (Already covered by classify_test.go.) - FamilyMisc: rseq is not in the explicit family table and falls through to Misc, grouped with its closest per-thread sibling set_robust_list/get_robust_list (also Misc). - Return value is int 0/-1 with no byte count, so its exit stays UNCLASSIFIED. Add lock-in tests for the family and return-value classification (kind was already covered) so a future drift in either is caught. Co-Authored-By: Claude Opus 4.8 --- internal/generate/family_test.go | 11 +++++++++++ internal/generate/retclassify_test.go | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/internal/generate/family_test.go b/internal/generate/family_test.go index e2d80b8..a708090 100644 --- a/internal/generate/family_test.go +++ b/internal/generate/family_test.go @@ -41,6 +41,17 @@ func TestClassifySyscallFamily(t *testing.T) { {"sys_enter_ioperm", FamilyMisc}, {"sys_enter_iopl", FamilyMisc}, {"sys_enter_modify_ldt", FamilyMisc}, + // rseq(2) registers/unregisters a per-thread restartable-sequences area + // (a userspace struct pointer, not an fd/path). It is not in the explicit + // family table and intentionally falls through to Misc, sharing the family + // with its closest per-thread sibling set_robust_list/get_robust_list + // (also Misc). set_tid_address is Process, but rseq is grouped with the + // robust-list pair rather than the tid-address syscall; keep this in sync + // with the Misc list in docs/syscall-tracing-plan.md. + {"sys_enter_rseq", FamilyMisc}, + {"sys_exit_rseq", FamilyMisc}, + {"sys_enter_set_robust_list", FamilyMisc}, + {"sys_enter_get_robust_list", FamilyMisc}, {"sys_enter_unlisted_future_syscall", FamilyMisc}, } diff --git a/internal/generate/retclassify_test.go b/internal/generate/retclassify_test.go index 1bbde51..3adae6e 100644 --- a/internal/generate/retclassify_test.go +++ b/internal/generate/retclassify_test.go @@ -47,6 +47,10 @@ func TestClassifyRetUnclassified(t *testing.T) { // gettimeofday(2) returns int 0/-1 (no byte count); its exit carries a // plain ret_event and must stay UNCLASSIFIED, not a read/write transfer. "gettimeofday", + // rseq(2) returns int 0/-1 on (un)registration of the restartable- + // sequences area; it transfers no bytes, so its exit must stay + // UNCLASSIFIED (plain ret_event), like its KindNull siblings. + "rseq", } for _, name := range unclassified { if got := ClassifyRet("sys_exit_" + name); got != Unclassified { -- cgit v1.2.3