Repository navigation
test: scale the adversarial suite's RSS budget to the build - #3073
Conversation
The three RSS-measuring tests in adversarial_redteam_stress_tests.rs read their ceiling from rss_budget_mib() instead of a hard-coded 256: still 256 MiB uninstrumented, 1 GiB when a sanitizer's shadow map is present. The failure message now names the budget it broke. Both nightly AddressSanitizer legs failed blackbox_builtin_adversarial_attacks in run 47263332281 (53 -> 379 MiB and 56 -> 395 MiB) while required CI stayed green on the same commit. Nothing leaked: the same workload costs a 49 MiB delta natively, and ASan multiplies it with per-allocation redzones plus a 256 MiB default free-list quarantine that holds freed blocks resident by design. A flat ceiling was measuring instrumentation, not retention. The ceiling moves rather than the assertion, so an instrumented run keeps a real bound at ~3x the measured delta while the runaway growth these tests exist to catch is multi-gigabyte against tight_limits() and a 512 KiB filesystem. cfg(sanitize) is still unstable and this suite builds on the pinned stable toolchain, so sanitizer_shadow_present detects the build from virtual size: a sanitizer reserves ~14 TiB of address space for its shadow map, three orders of magnitude above anything an uninstrumented test binary maps. rss_budget_follows_the_shadow_map pins that threshold against both measurements.
Review summary (head
|
Review follow-ups on the per-build RSS budget. /proc/self/statm counts pages, and the 4 KiB multiplier assumed a page size the host need not have: on a 16 KiB-page aarch64 kernel every number was a quarter of the truth, on 64 KiB-page ppc64 a sixteenth. That loosens a ceiling rather than breaking it, so it would not have announced itself. The reader now takes VmRSS and VmSize from /proc/self/status, which reports kB and needs no page size, and the pin test asserts both read non-zero so a silent parse failure cannot leave the budget assertions passing vacuously. rss_budget_for takes the virtual-size measurement as an argument and rss_budget_mib delegates to it, so the pin test reaches both branches: measuring the live process can only ever exercise the one this build is on, which let a hardcoded return value pass.
The section's first sentence still pointed at /proc/self/statm after the reader moved to /proc/self/status, two paragraphs above the rule that says why.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | ccf7247 | Commit Preview URL Branch Preview URL |
Dec 04 2026, 09:40 AM |
|
Verified against the job that was red. Dispatched
Required CI is green on Generated by Claude Code |
What changed
The three RSS-measuring tests in
adversarial_redteam_stress_tests.rsnow readtheir ceiling from
rss_budget_mib()instead of a hard-coded256: still256 MiB on an uninstrumented build, 1 GiB when a sanitizer's shadow map is
present. The failure message also names the budget it broke, so the next
instance explains itself from the log line alone.
No product code changes; nothing about what the tests exercise changes.
Why
The nightly
AddressSanitizerlegs both failedblackbox_builtin_adversarial_attacksin run 47263332281 —
RSS grew too much during builtin attacks: 53 -> 379 MiB(interpreter) and
56 -> 395 MiB(execution-plan) — while required CI stayedgreen on the same commit.
Nothing leaked. The same workload costs a 49 MiB delta natively (measured in
#3066, each measuring test alone in its process). ASan multiplies it: redzones
around every allocation, plus a 256 MiB default free-list quarantine that holds
freed blocks resident on purpose. A flat 256 MiB ceiling was therefore measuring
instrumentation, not retention — the same native-versus-instrumented divergence
this suite's budgets have hit twice before (nightly #46806775136 on a cap
timeout, run 257 on
RLIMIT_AS).The ceiling moves rather than the assertion: an instrumented run keeps a real
bound at ~3x the measured delta, and the runaway growth these tests exist to
catch is multi-gigabyte against
tight_limits()and a 512 KiB filesystem.Deleting the check on instrumented builds would retire the coverage on the build
most likely to expose a leak.
cfg(sanitize)is still unstable and this suite builds on the pinned stabletoolchain, so the build is detected at runtime: a sanitizer reserves ~14 TiB of
virtual address space for its shadow map at startup (the reservation
knowledge/operations/testing.mdalready records from theRLIMIT_ASincident), three orders of magnitude above anything an uninstrumented test
binary maps.
Before / After
AddressSanitizer (interpreter)/(execution-plan)— red on a326 MiB and a 339 MiB delta against a 256 MiB ceiling → the same deltas sit
inside the 1 GiB instrumented ceiling. Verified by dispatching
Nightlyonthis branch (link in the thread below).
the suite's worst native delta is still 49 MiB.
cargo test -p bashkit --test adversarial_redteam_stress_testspasses in 4.0s, 10/10.ceiling, and the message now prints which one.
Risk
pass on a sanitized run. It would still fail the identical assertion on every
required-CI run, where the ceiling is unchanged.
/proc/self/statmvirtual size.Misdetection can only pick the other constant, never skip the assertion, and
rss_budget_follows_the_shadow_mappins the threshold against bothmeasurements as a plain
#[test].Checklist
Generated by Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.