Repository navigation
fix(tests): resolve the spawned CLI binary without guessing cargo layout - #2691
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | d21fbc6 | Commit Preview URL Branch Preview URL |
Oct 11 2026, 10:22 PM |
chaliy
force-pushed
the
eve/clever-mccarthy-phbm3d
branch
from
October 11, 2026 22:19
ea24318 to
891eea7
Compare
The bounded-child harness took the profile directory to be the test binary's grandparent, which holds only for `<profile>/deps/<test>`. Cargo 1.101-nightly's separate build directory puts the test binary in `<profile>/build/<package>/<hash>/out/`, so the lookup resolved into a hashed build directory and the five CLI-spawning regressions failed on a path that never existed (`NotFound` before the launcher landed, exit 127 after) rather than on the bounds they assert. That is why the nightly ASAN job went red on run 252 while required CI, on the pinned stable toolchain, stayed green on the same commits. Only the export of the final binary into the profile directory is contractual, and that directory is an ancestor of the test binary under either layout, so the lookup now walks up until it finds the binary and fails closed naming every path it ruled out. `is_file` is load-bearing: the nightly layout has a package-named `build/bashkit` directory that a bare existence check would accept. The walk stops at cargo's target directory, recognised by its `CACHEDIR.TAG`, so a same-named file above the build tree is never spawned in place of the binary under test; a depth bound applies whether or not that marker is present. `--bins` is not the mechanism and is not used: on nightly it builds the binary only as a test harness inside the hashed build directory and exports nothing runnable. What makes cargo export it is selecting the bashkit-cli package, whose own integration tests get `CARGO_BIN_EXE_bashkit`; both the required CI job and the ASAN job already do that through `--tests`. Covered by `cli_lookup_resolves_known_cargo_layouts` over synthetic trees for both layouts, since the live tree only ever has its own toolchain's, including the directory collision and a decoy above the target directory. Claude-Session: https://claude.ai/code/session_01AZCDWdi9DiWzZF5VmWdqXM
chaliy
force-pushed
the
eve/clever-mccarthy-phbm3d
branch
from
October 11, 2026 22:21
891eea7 to
d21fbc6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
The bounded-child harness now finds the
bashkitCLI binary it spawns by walkingup from the test binary until the binary turns up, instead of assuming a fixed
depth, and fails closed naming every path it ruled out. No product code changes,
no workflow changes.
Why
Nightly run 252's AddressSanitizer job went red on
threat_model_tests::resource_exhaustion::indirect_hostile_cycles_rejected_in_bounded_childwith
spawn bashkit CLI: Os { code: 2, kind: NotFound }, while required CI onthe same commits stayed green.
The harness runs hostile reproducers in a child CLI process by design
(TM-DOS-135: pre-fix they overflowed the stack and aborted the whole test
runner). It located that binary as the test binary's grandparent directory,
which holds only for the
<profile>/deps/<test>layout of the pinned stabletoolchain. Cargo 1.101-nightly's separate build directory puts the test binary
at
<profile>/build/<package>/<hash>/out/<test>, so the lookup resolved into ahashed build directory and the five CLI-spawning regressions failed on a path
that never existed —
NotFoundbefore the launcher landed, exit 127 after —rather than on the bounds they assert. A red nightly that said nothing about the
product, and a security regression that had stopped being exercised there.
Only the export of the final binary into the profile directory is contractual,
and that directory is an ancestor of the test binary under either layout, so
that is what the lookup relies on now.
Two things worth recording, both measured on
cargo 1.101.0-nightly (29c5daa1a)with
-Z build-std --target x86_64-unknown-linux-gnu:--binsis not the mechanism, which is why this PR does not add it: onthat toolchain it builds the binary only as a test harness inside the hashed
build directory (
build/<pkg>/<hash>/out/<name>-<hash>) and exports nothingrunnable.
bashkit-clipackage,whose own integration tests get
CARGO_BIN_EXE_bashkit. Both the required CIjob and the ASAN job already do that via
--tests, so the binary was presentall along — only unfindable.
Before / After
Reproducing on
mainwith a selection narrow enough to excludebashkit-cli(the shape in which the path bug is visible on stable too):
Exit 127 is the launcher's
execof a path that does not exist — nothing to dowith the hostile script under test. After, the same invocation names the cause
and every directory ruled out:
The nightly layout, measured directly in a minimal workspace on the nightly
toolchain, with the old fixed-depth guess and the new walk side by side:
With the binary present, the harness module passes (the five CLI cases plus the
new layout case):
Authoritative proof: the Nightly workflow is dispatched on this branch, so its
AddressSanitizer job reports against this head directly.
Other local checks:
cargo fmt --checkclean,cargo clippy -p bashkit --testsclean,
just check-okfconformant,just check-doc-linksOK.Risk
ways: it requires a regular file, so the package-named
build/bashkitdirectory cannot be mistaken for the binary; it stops at cargo's target
directory, recognised by its
CACHEDIR.TAG, so a same-named file above thebuild tree is never spawned; and it is bounded to six ancestor levels (five
are needed for the deepest known layout) whether or not that marker is
present. Absence stays an error rather than a path that fails later.
Checklist
cli_lookup_resolves_known_cargo_layoutscoversboth layouts over synthetic trees, since the live tree only ever has its
own toolchain's layout, plus the directory collision, a decoy above the
target directory, and the absent case
https://claude.ai/code/session_01AZCDWdi9DiWzZF5VmWdqXM