perf(cws): Record v2 syscall samples in a per-process bitmap #58897
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 241 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.328
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #58897"
general
weight: 0.35
mftoure
What does this PR do?
Reworks the Profiles v2 syscall sampler: a dedicated
sys_enter_syscall_usageprogram sets the syscall's bit in a per-process bitmap, and a 1 Hz ticker plus the exec/exit hooks send oneEVENT_SYSCALLSper process. This replaces the per-(process, syscall) map, rate limiter, ignored syscalls list and refresh events of #54996.syscallsis insecurity_profile.v2.event_types(the default). Theevent_sampling.syscallssettings are removed.security_profile.v2.max_syscalls_events_per_second(default 1024) caps the ticker sends. Syscalls not sent because of the cap or a dropped event are kept for the next tick.bpf_for_each_map_elem(5.13+, 5.17+ on arm64), and turns itself off on older kernels.Motivation
With the #54996 sampler,
sys_entercosts ~600ns per syscall (redis -21%). Tradeoffs: new syscalls reach userspace 1-2s later, a send racing with a first use can drop a bit (no atomics), and the map takes ~4.2MB on 16 CPUs (256B per process, 4 cache lines) instead of ~1.8MB.Describe how you validated your changes
sys_enteris 5-6x cheaper per call and redis +17%. Vs sampling off: +145ns per syscall, redis -7.5%, postgres -3.5%, nginx -1.2%.TestWorkloadProfileDedicatedSyscallsReporting(while running, on exec, refresh) andTestWorkloadProfileDedicatedSyscalls(on exit). Baloum tests:TestSyscallUsageRecord,TestSyscallUsageExcluded.bpf_for_each_map_elemcallback as a loop, so the ticker keeps its send counter in a map).Additional Notes
The activity dump / drift monitor in
sys_enteronly runs when enabled (the kill fallback is kept). The ticker cap and the re-queue of dropped events have no test: baloum doesn't supportbpf_for_each_map_elem.