Repository navigation
Deflake test_write_what_where_shadowstack - #124
Conversation
|
Corpus decompilation diffs can be found at angr/dec-snapshots@master...angr/rex_124 |
There was a problem hiding this comment.
remove the comments you added, then lgtm
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Validation record for the flake characterization behind this change. All trials on one x86-64 Linux host under an unrelated concurrent workload (load average 5-46, mean 22);
The decisive arm is paired, which keeps machine load out of the comparison: 240 trials, each generating one exploit and then evaluating both assertions in the same process, moments apart — 7 failures for the old assertion, 0 for the new. Predicted rate from the mechanism: a zero byte anywhere in the four leaked bytes, Two things this is not:
Confirmed CI instance: angr/angr#6854, run If you would rather assert reliability explicitly than pin the seed, |
The test asserted a single randomly seeded run of the generated CGC type-2
POV, which is a coin flip rather than a test of the exploit.
Mechanism. The challenge binary leaks through
send_all(1, message, strlen(message))
and the exploit's write-what-where points `message` at the CGC magic page.
povsim asks for exactly 4 bytes (read_size is hard-coded in
cgc_pov_simulator._do_binary_negotiation_type_2) and accepts the run only if
those 4 bytes occur in the magic page. When the seeded flag page holds a zero
byte inside the four bytes being leaked, strlen stops early, the POV's 4-byte
read runs on into the challenge's own `send_all(1, &foo, 4)` filler, and
povsim sees 0x5a5a5a5a ("ZZZZ") instead of flag data:
received flag data 0x5a5a5a5a
pov successful? False
That is 1 - (255/256)**4, about 1.5% of seeds, and it is a property of the
target's strlen-bounded leak primitive, not of the exploit: no choice of
offset avoids it, because the flag page is regenerated from a fresh seed on
every run. Measured over 900 randomly seeded runs of one generated POV:
8 failures (0.89%). Measured end to end, generating a fresh exploit each
time: 3 failures in 217 runs (1.38%). Failing runs took 0.15-1.67s inside
test_binary, so povsim's 15s negotiation budget is not involved.
Fix: pin the flag page with enable_randomness=False so the assertion is about
the exploit rather than about the seed. 240/240 end-to-end runs pass with it,
against 3 failures in the paired randomly seeded arm.
The `Fail to set register: ... to: 0x41414141` errors angrop logs during this
test are unrelated noise. They are emitted on passing runs too; pytest only
prints captured logs for failures, which is why they look like a symptom.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
e831e12 to
f967dc7
Compare
|
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS Done — comments removed in The reasoning moved to the description and to the validation comment (#124 (comment)), which is where the measurements belong rather than in the test body. session: pr-review |
THIS MESSAGE WAS GENERATED BY AN AUTOMATED PROCESS
test_write_what_where_shadowstackfails intermittently in the sharedci / Test (0)shard, so it reddens pull requests in repositories that cannot reach CGC exploit synthesis at all — angr/angr#6854, a decompiler change, among them.The exploit is fine; the assertion is a coin flip. The challenge leaks through
send_all(1, message, strlen(message)), and the synthesized write-what-where pointsmessageinto the CGC magic page. povsim asks for exactly four bytes and accepts the run only if they occur in the page it dumped. When the seeded flag page holds a zero inside those four,strlenstops early, the read runs on into the challenge's own filler, and povsim is handedZZZZ.test_binaryreseeds the flag page every run, so no leak offset avoids it. Pinning the page withenable_randomness=Falsemakes the assertion about the exploit rather than about the seed.Validation: #124 (comment)
session: pr-review