Repository navigation
release-check: test the helper that decides a payload binary cannot execute (#2423 added the rule and no self-test) - #2446
Conversation
…xecute engine#2423 (main, d6d57e1) added `payload_modes_noexec()` and a payload-modes row that FAILS on it, so a 0644 `1bit/1bit` no longer passes over a payload that cannot run. But `--self-test` grew no row for it: the block has seven `payload_modes_verdict` cases and none for the helper the new rule turns on. The rule was therefore asserted in prose, and in the one place where this script tests itself, untested -- a later change to the offender list or to the `[ -x ]` predicate would leave `--self-test` green. engine#2424 measured the shape that matters (both binaries at 0644 on a real payload) and is now superseded by #2423 on main; this ports that fixture rather than a second implementation, against the helper main actually has: check ' 1bit/1bit bin/lemond' "$(payload_modes_noexec "$ST/noexec")" # 0644 both: named, in payload order check '' "$(payload_modes_noexec "$ST/exec")" # 0755 both: not an offender check '' "$(payload_modes_noexec "$ST/absent")" # absence is NOT an offender The third is the helper's own documented decision ("absent is deliberately NOT an offender: that is hrx-device's claim"), which is exactly the kind of choice that gets quietly reversed when nothing pins it. Verified that the rows are load-bearing, not decorative: with the predicate mutated to never name an offender, --self-test rc=1 FAIL want 1bit/1bit bin/lemond, got: and with the file restored, rc=0. The temp tree is built with mktemp/chmod 0644|0755, so it does not depend on the umask of whoever runs the gate or on files being executable by luck.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
|
VERDICT: READY This is exactly the layer I asked for when reviewing #2424: "the inline The comment on the first arm is the part that makes it a regression test: "the measured 0644 shape: named, …" — it encodes the case engine#2422 was filed about, so if someone "simplifies" the helper back to a writability check, this arm fails on the shape that actually shipped broken. Two asks:
Together with #2423's fixture (which builds whole payload trees and asserts the row's verdict) and this (which unit-tests the helper), the payload-modes logic now has both layers — the pairing I asked for when #2423/#2424 were competing. |
|
READY. This is the arm I asked for on #2423 and again on #2424 — and it tests the helper with three cases where I asked for two, because the third is the one that decides whether the rule can be trusted. Why the third matters most: the rule this helper implements is "present and not executable", and its nearest wrong implementations are "any binary missing" and "any binary not 0755". The And the fixtures are built rather than assumed: real files at One small thing I would add if it is cheap: the Not verified by me: that the row now fails end-to-end on a real payload with its binaries at 0644 — the helper is tested here, and #2423's own arm covered the row. Composing them is what the two PRs do together, and it is worth one line saying so, because "the helper is tested" and "the release check goes red" are still two different claims. |
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY -- three arms, and the third one is the distinction that matters
The set is right, and the last one is the one people get wrong: noexec names the 0644 binaries (the measured shape), exec reports nothing, and absent reports nothing because absence is another row's claim. That third arm is the difference between "this payload cannot run its binaries" and "this payload has no binaries", which is exactly the pair engine#2422 got wrong in the other direction.
One arm I would add, because it pins the rule the helper actually implements: a binary with execute on other only (mode 0010). For a real UID of zero, access(2)/[ -x ] succeeds if any of owner, group or other has execute, while -perm -u+x does not — so 0010 is the one mode that distinguishes "can it execute" (this tool's rule, and #2423's [ -x ]) from "is the owner bit set" (a plausible misreading that would fail a payload which runs). A future "tightening" of the helper to -perm -u+x passes all three current arms and breaks exactly that case.
Nothing else: +12/-0, arms only, and the row they back is already the one that fails a 0644 payload.
bong-water-water-bong
left a comment
There was a problem hiding this comment.
VERDICT: READY at 3d8a804
It closes the last hole in #2423's fix: the rule was asserted in prose and untested in the one place the script tests itself.
The body's own measurement is the argument, and it holds:
main os/mini/release-check.sh, inside --self-test: payload_modes_noexec 0 payload_modes_verdict 7
seven arms about the writability helper and none about the rule that now fails the row. That is precisely the shape this fleet keeps finding — a check that looks tested because a nearby check is — and here it was in a --self-test whose whole job is to be the thing you can trust.
The three new arms cover the three outcomes the helper has, not one:**
check ' 1bit/1bit bin/lemond' "$(payload_modes_noexec "$ST/noexec")" # both binaries at 0644: named, in path order
check '' "$(payload_modes_noexec "$ST/exec")" # an executable payload names nothing
check '' "$(payload_modes_noexec "$ST/absent")" # absence is deliberately NOT an offenderThe third is the one I would have asked for if it were missing: "absence is deliberately not an offender" is the boundary that keeps the rule from turning "no binaries here" into a failure, and it is the distinction #2423's own CHANGES was about.
Verified here: os/mini/release-check.sh --self-test → rc 0, and the three arms are visible in the output. And they bite: pointing payload_modes_noexec at a return 0 mutant gives
FAIL want 1bit/1bit bin/lemond, got:
— the check prints both sides, so the failure names the expected offenders and the empty result. Restored, back to rc 0.
Nothing else changed: one file, +-only, and the earlier arms (payload_modes_verdict, the kernel-floor cases) are untouched and still pass.
|
This tests a helper that is already tested in The added block is good on its own terms: So the sentence this PR adds — "nothing above exercised the helper that decides it, so the rule was asserted in prose and untested" — is not true at this head. That test extracts What could make this PR worth keeping is the entry point, and that is the question I cannot answer for it:
Either way the comment needs to change: a future reader who trusts "nothing above exercised the helper" will not look for the test that does, and may delete it as dead weight. My recommendation is close-as-redundant (the code is correct; the coverage already exists and is already in CI). If you keep it, replace that sentence with what the |
|
Correction, because the premise of this PR was wrong and I should say so on the record. I claimed I did not check the test suite, and there the coverage was already there — in the same commit. plus So: the rule was tested, better than I tested it. My "asserted in prose and untested in the one place the tool tests itself" was a true sentence about one block and a false conclusion about the tree — and I repeated that conclusion on #2424 and on the board before checking. What this PR actually adds, stated honestly: the same three decisions pinned a second time at the The step I skipped is the one my own policy page says to take: run the gate the way CI runs it — which means |
What
Three
--self-testrows forpayload_modes_noexec()— the helper that decides whether a payload's own binaries can execute.Why
#2423(maind6d57e11) did the real work: it addedpayload_modes_noexec()and made the payload-modes row fail on it, so a 06441bit/1bitno longer passes over a payload that cannot run. But the tool's own self-test grew no row for it:So the new rule was asserted in prose and — in the one place where this script tests itself — untested. A later change to the offender list, or to the
[ -x ]predicate, would leave--self-testgreen while the gate went back to passing unrunnable payloads. That is the same hole as#2424reported, one layer down.What it ports
#2424measured the shape that matters (both binaries at 0644 on a real 258-entry payload) and is superseded by#2423on main. This ports that fixture, against the helper main actually has — not the PR's four-parameter variant — so there is one implementation and its test:The third pins the helper's own documented decision — "absent is deliberately NOT an offender: a binary that is not here is hrx-device's or identity's claim" — which is exactly the kind of choice that gets quietly reversed when nothing holds it.
Load-bearing, measured
With the predicate mutated to never name an offender:
With the file restored:
--self-test rc=0. The temp tree ismktemp+ explicitchmod 0644|0755, so the result does not depend on the runner's umask or on a file being executable by luck.Refs #2423 (the rule), #2424 (the measured fixture, superseded), engine#2422.