Skip to content

release-check: payload-modes prints the binaries' modes but does not require 0755, so a payload whose engine cannot run passes the check #2422

Closed

Description

@bong-water-water-bong

The row prints the two binaries' modes but does not require them, so a payload that cannot run passes release-check

Found by accident while rolling a payload (my own normalisation ran chmod 0644 before the +x pass, so nothing was executable - and the check still said PASS).

Measured on a real 258-entry payload (c31's tree, fresh lemond rolled in), release-check.sh --check:

PASS  payload-modes : no path in the payload is group- or other-writable … (modes: 644 1bit/1bit 644 bin/lemond 644 lemond-onebit)

Both binaries are 0644. The row prints them (_pm_bits, engine #1352's "the identity of a boot says 0755 rather than leaving a reader to trust that a mode fix happened") but its verdict is only about group/other-writability, so 0644 passes.

And nothing else catches it, because the row that would use the binary tests executability and then skips:

release-check.sh:1403   for _b in … /opt/1bit-package/1bit/1bit …; do [ -x "$_b" ] && { ONEBIT_BIN=$_b; break; }; done
release-check.sh:1408   skip hrx-placement "no 1bit engine binary in the image, so the two arms cannot be started"

So the combination is PASS payload-modes + SKIP hrx-placement: a release check that is green over a payload whose engine cannot be executed. A SKIP is the right verdict for "the binary is not here"; it is the wrong verdict for "the binary is here and is not runnable" - and today the two are indistinguishable.

Fix (patch below, ~6 lines, in the same else branch that prints _pm_bits): after the writability verdict, require the two binaries the row already names to be executable, and fail naming the one that is not. Absent binaries keep today's behaviour (this row's claim is about modes of what is there; absence belongs to hrx-device/identity).

        # The bits are printed above, but printing is not asserting: a 0644 `1bit/1bit` passes the writability rule and
        # then makes hrx-placement SKIP (`[ -x ]`), so the release check is green over a payload that cannot run.
        _pm_noexec=
        for _b in "$PDIR/1bit/1bit" "$PDIR/bin/lemond"; do
            [ -f "$_b" ] || continue                      # absence is not this row's claim
            [ -x "$_b" ] || _pm_noexec="$_pm_noexec ${_b#"$PDIR"/}"
        done
        if [ -n "$_pm_noexec" ]; then
            fail payload-modes "in the payload but not executable:${_pm_noexec} - a 0644 engine or lemond refuses to run, and hrx-placement then SKIPs instead of failing"
            : "$PM"                                       # the writability verdict is still printed by --verbose runs
        else
            case "$PM" in
                PASS*) pass payload-modes "${PM#PASS }${_pm_bits:+ (modes:$_pm_bits)}" ;;
                *)     fail payload-modes "${PM#FAIL }${_pm_bits:+ (modes:$_pm_bits)}" ;;
            esac
        fi

Case table (each row is a fixture I will add to rowproof-payload-modes.sh, which builds real trees with real modes):

payload expected
everything 0755/0644 clean, both binaries 0755 PASS payload-modes, modes: 755 1bit/1bit 755 bin/lemond
1bit/1bit 0644, rest clean FAIL payload-modes … not executable: 1bit/1bit
bin/lemond 0644, rest clean FAIL payload-modes … not executable: bin/lemond
both binaries absent (a partial tree) unchanged: no new FAIL (absence is hrx-device's claim)
one group-writable file (today's case) unchanged: FAIL … group- or other-writable

Scope note: I am not proposing that the modes row take over executability for the whole payload - only for the two paths it already names in its own output. And the fix is inert on a correctly packed tree: the packer writes 0755 for executables, so only a broken roll changes verdict.

Found while closing the package roll / release-check --check rows for the C33 table; the payload I built is under ~/.cache/scratch-trel3/roll32/ and the reproduction is three commands. I will open the PR against this issue when a lane slot frees (2 open PRs today).

Activity

  1. bong-water-water-bong commented on Nov 14, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Claiming this lane (pi-i679). This is the shape I have been reviewing all night, in the last place it should be: a release check that reports a property and does not assert it, so a payload whose binaries cannot execute says PASS.

    What makes it worth fixing first is the measurement: a real 258-entry payload with both 1bit and lemond at 0644, and the row printing those modes inside a green PASS line. A reader sees (modes: 644 1bit/1bit 644 bin/lemond ...) and has to know that 644 is wrong to notice -- and the line is long, green, and says PASS first.

    Two things I will check before changing it, because this is the release gate and a false failure is expensive:

    1. which paths must be executable. Not everything in a payload should be 0755; the requirement belongs to the binaries and any script the payload runs, and the mode comes from the packer rather than from a fixed list. The check should derive its required set from what the row already knows -- the same way it already knows which two binaries to print -- rather than grow a hardcoded list that rots.
    2. whether 0755 specifically or "any execute bit" is the rule. A payload built by a different umask could legitimately be 0750 or 0700, and requiring 0755 would then fail a payload that works. If the row already has an opinion, it should say which; if not, "the owner bit is set" is the property that decides whether it can run, and 0755 is a convention.

    What I will not do: turn the row into a hard failure for a mode I have not seen the packer produce. The first version asserts the property the row already prints, on the paths it already names, and the arm is a payload with a 0644 binary -- which is the payload this was found on.

    I will report the before/after on that same measured payload.

  2. bong-water-water-bong commented on Nov 14, 2026

    @bong-water-water-bong
    CollaboratorAuthor

    Fixed on main by d6d57e111, and I am withdrawing the patch I had prepared — theirs is better than mine in three ways. Verified here rather than assumed:

    $ bash tests/release_check_payload_modes_test.sh os/mini/release-check.sh
    ok    a 0644 engine and lemond are both named as not executable
    ok    a 0755 payload reports nothing
    ok    a payload with no binaries reports nothing (absence is another row's claim)
    release_check_payload_modes_test: 0 failure(s)
    

    Where their version beats what I had on lane/pmodes-exec (never pushed — the 2-PR cap is why, and this is the happy ending of that wait):

    1. Three binaries, not two. They check lemond-onebit as well as 1bit/1bit and bin/lemond; my patch checked the two the row prints and would have passed a payload whose launcher is 0644.
    2. [ -x ], deliberately, not "is it 0755". Their comment cites access(2): a real UID of zero passes X_OK if any execute bit is set, so "can it execute" is the right predicate on an appliance that runs as root. My patch said "not executable" but reasoned about 0755.
    3. A fast unit test instead of three full checks. Their note about the first fixture running release-check.sh --check three times and costing 392 s in CI (130 s per arm in a container) is a cost I would have paid: my rowproof added three fixtures to a script that runs the whole check per case.

    The one thing worth carrying over from my attempt, if anyone edits this row again: the both-binaries-absent case must stay green. Their test has it explicitly (mktree pnone none → "reports nothing"), so it is already covered — that was the case I would have got wrong by treating absence as a failure.

    Also for the record: the row still prints the modes on the pass line (pass payload-modes "… (modes:$_pm_bits)"), so the original #1352 intent ("the identity of a boot says 0755") survives — it is now asserted as well as printed.

    Measured on the real 258-entry payload before this landed:

    PASS  payload-modes : … (modes: 644 1bit/1bit 644 bin/lemond 644 lemond-onebit)
    SKIP  hrx-placement : no 1bit engine binary in the image, so the two arms cannot be started
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions