Repository navigation
Conversation
On WSL2, `rocm install driver` downloaded the ROCDXG .deb to a fixed, predictable name in the world-writable /tmp, checked its SHA-256 there, then ran `sudo apt-get install` on that same path. Another local user could create or replace that file between the digest check and the install, so the package whose maintainer scripts run as root was not necessarily the one that was checked. The plan now makes /var/cache/rocm-cli/rocdxg root-owned and 0755 on every run, downloads without sudo into a private `mktemp -d` directory that is removed on exit, copies the file into the root-only directory with `sudo install -m 0644`, checks the digest of that root-owned copy, installs that same file and removes it afterwards. A package rejected by the check or by apt-get stays in the root-only directory until the next run of the same version replaces it. New unit tests check the plan text for both the sudo and the already-root plan, and run every generated Execute step, each in its own `sh -c`, against stand-in sudo, curl, install and apt-get. The WSL dry-run scenario gains a step asserting the same layout on the rendered plan. The `rocm fix` and `rocm diagnose` notes and the WSL, release-trust and testing docs, including the manual steps, now describe the root-only staging. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
…in the staging location The manual WSL steps ran `sha256sum -c` and `sudo apt install` as separate lines, so a pasted block printed FAILED on a digest mismatch and then installed the rejected package as root anyway. The check, the install, the removal and `ldconfig` are now chained with `&&`, and the prose says the copy that is checked is the root-owned one. The plan-text test now asserts the staged package sits under an allowlisted root-only system directory rather than only "not /tmp", since /dev/shm or /var/tmp would pass that check while being just as world-writable; the WSL dry-run scenario asserts the same. It also pins the removal step to the plan's escalation, because the staged file is root-owned and an unprivileged `rm` would fail and stop the plan before `ldconfig`. A comment records that /var/cache/rocm-cli is reserved for root-owned driver staging, since the plan resets its owner and mode on every run. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
The plan runs `install -d -m 0755 -o root -g root` on both /var/cache/rocm-cli and its rocdxg subdirectory, because whoever can write the parent can rename the staging directory away and put their own in its place. Dropping the parent from that command left every test green: the plan-text test only matched a prefix and the staging directory, and the stand-in run let `install -d` create both directories under the default umask, which already gives 0755. The plan-text test now pins the whole command, and the stand-in run starts both directories at 0777 so the 0755 it asserts can only come from the plan resetting them. Each assertion fails on its own when the parent is dropped. Also give ROCDXG_STAGING_DIR its own doc comment (it sat on the parent constant), stop the module header claiming the plan's behaviour is unchanged since the relocation, and narrow the comment on the reset to what `install -d` actually resets: the two directories, not their contents. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
The `fix-wsl-3-rocdxg-missing` note now says the digest is checked on the root-placed copy that gets installed. The rocm-doctor eval fixture records `rocm fix` output for a WSL host and still held the old wording, so `cargo xtask eval-fixtures --check` failed. Regenerated with `cargo xtask eval-fixtures`; only the two note strings change. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
75b204f to
ec42a59
Compare
Security scan found no critical or high findings on lines changed by this pull requestView the security scan run for complete reports. “New” means the finding is located in a changed file on an added or modified line; it is not a base-versus-head findings delta. |
juhovainio
left a comment
There was a problem hiding this comment.
Nothing here is a security or correctness blocker: the checked file is now the installed file, the staging directory and its parent are reset to root-only on every run, and the test runs each generated step separately with a curl shim that rejects sudo and non-0700 download dirs. CI is green. I'm requesting changes only for one docs fix that is the same "pasted block keeps going after a failure" problem this PR fixes a few lines lower, plus a couple of notes.
Worth fixing
- In the manual steps in
docs/wsl.md, thecurl,sudo installandrm -rflines are not chained, while the check/install/rm/ldconfig lines below them are. If the download fails, a pasted block carries on tosudo installon a missing file and then runssha256sum -cagainst whatever an earlier run left in the staging directory. The digest still gatesapt, so it is not a hole, but chain the download/copy lines with&&as well (see the inline comment).
Non-blocking
- The
root:rootowner reset (install -d -m 0755 -o root -g root) is only pinned by string match: the test stand-in drops-o/-g, so ownership is not actually exercised. The PR body discloses this; fine to leave, but worth a comment next to the assertion saying so.
For the author to decide
- A package that fails the check or that
aptfails to install stays in/var/cache/rocm-cli/rocdxguntil the next same-version run, androcm uninstalldoesn't know about the directory. The PR discloses this and the docs give a one-line cleanup. A trap or||cleanup step on failure would be the alternative if you want it self-cleaning. - The staged file keeps a fixed, versioned name rather than a per-run unique one. That's sound given the directory is root-only and reset each run.
I did not re-run the mutation list or the unit tests locally; this is from reading the diff plus the CI results.
| d="$(mktemp -d)" | ||
| curl -L --fail -o "$d/${ROCDXG_DEB}" \ | ||
| "https://github.com/ROCm/librocdxg/releases/download/v${ROCDXG_VERSION}/${ROCDXG_DEB}" | ||
| sudo install -m 0644 "$d/${ROCDXG_DEB}" "${ROCDXG_STAGED}" |
There was a problem hiding this comment.
Chain the curl, this sudo install and the rm -rf "$d" cleanup with &&, as the check/install lines below are. As written, a failed download stops nothing in a pasted block: it falls through to sudo install on a missing file, and sha256sum -c then checks whatever a previous run left staged.
There was a problem hiding this comment.
Fixed in bcfe9b1 and 152b497. The whole block, from mktemp -d through ldconfig, is now one && chain, so a failed download stops before sha256sum -c and a copy an earlier run left staged is never checked or reinstalled. The chain runs in a subshell with trap 'rm -rf "$d"' EXIT, as the generated plan does, so the private directory is removed on every path and the block's exit status is the chain's: a failed download, check or install no longer reports success.
The new test wsl_doc_manual_steps_stop_before_the_check_when_the_download_fails extracts this block from docs/wsl.md with include_str! and runs it against stand-ins. With a good copy already staged and a failing download, nothing is installed and the block exits non-zero. A failed install also exits non-zero, and a good download installs once. It fails against the previous block, and against a block that swallows only the install's failure.
juhovainio
left a comment
There was a problem hiding this comment.
atom# Review — needs work
Full review of the whole change (base 778c970f…head ec42a59d). No ticket named; the PR's own checklist states there is none (purely a direct fix with no referenced issue).
Blocking
docs/wsl.md's manual download/stage steps are not chained, unlike the check/install/rm/ldconfig block right below them —docs/wsl.md:112-116
Read directly from the file:d="$(mktemp -d)", thecurldownload, thesudo installcopy into the root-only directory, andrm -rf "$d"are four separate statements with no&&between them, while the following block (sha256sum -c -/apt install/rm -f/ldconfig) is correctly chained with&&. Ifcurlfails, a pasted block falls through tosudo installon a missing source (also fails, noisily) andrm -rf "$d"(harmless), then reaches the digest check. On a first run this still fails closed since there's nothing staged yet to check. But if a.debfor the same version is already staged from an earlier successful run, the check re-passes against that leftover and the script quietly reinstalls it instead of surfacing that the download failed. The digest still gatesapt install, so this is not the TOCTOU race the PR closes a few lines below — but it is the identical "pasted block keeps going after a failure" defect class the rest of this same PR (and the generated plan inapps/rocm/src/driver_plan/rocdxg.rs:374-379, which chains the equivalent download+copy line with&&and atrap 'rm -rf "$d"' EXIT) is built to prevent.
Confidence 85 · mechanical · Fix: chain these lines with&&(and consider atrapfor the private dir cleanup) to match the generated plan and the block beneath them.
Non-blocking
None
Decisions for the author
- Ownership reset (
-o root -g root) is pinned only as a string, not exercised by root-owned behavior — answered-by-intent
PR body, "Not verified": "The owner reset (-o root -g root) is pinned as text only... The stand-in run cannot be root, so it proves the mode reset but not the ownership change." Would otherwise be a test-strength finding (the executable test'sinstallstand-in strips-o/-gbefore delegating to the realinstall). The disclosure is accurate and the mode-reset half is genuinely exercised (0777→0755 is asserted). Confirm this is still an accepted gap rather than something to close before merge. - A package rejected by the digest check or by
apt-getstays in/var/cache/rocm-cli/rocdxg/until the next run of the same version;rocm uninstalldoes not know about the directory — answered-by-intent
PR body, "Out of scope": "a rejected package can stay there until the next run of the same version...docs/wsl.mdgives the one-line cleanup. Teaching uninstall about root-owned driver leftovers is a separate change." Atrap/||self-cleaning step would be the alternative; the current choice (manualsudo rm -f .../*.deb, documented) is reasonable given the directory is root-only and inert between runs. - Fixed, version-keyed filename in the staging directory rather than a per-run unique name — tradeoff
A unique name per run would remove any chance of two concurrent installs of the same version colliding on the same path; the current choice is simpler and is safe specifically because the directory is root-only and its permissions/ownership are reset on every run, so the fixed name costs nothing against the TOCTOU threat model this PR addresses. Worth the author confirming concurrent-install collision is an accepted non-goal.
Positive signals
apps/rocm/src/driver_plan/rocdxg.rs:374-379chains the private download and the privileged copy into one&&-joinedsh -cline with atrap 'rm -rf "$d"' EXIT, so the privatemktemp -ddirectory is cleaned up even on acurlfailure mid-step — exactly the robustness the doc's manual steps (above) are missing.wsl_rocdxg_generated_steps_install_exactly_the_verified_file(apps/rocm/src/driver_plan/rocdxg.rs:1002-1197) actually executes every generated Execute-phase step throughsh -cagainstsudo/curl/install/apt-get/ldconfigstand-ins — including acurlstand-in that fails the test if invoked undersudoor asked to write outside a private 0700 directory — rather than asserting on substrings of the plan text. This is the stronger of the two kinds of test this PR adds, and it would fail if, for example, the digest-check target were quietly pointed back at the private download directory instead of the staged copy.
Deployment notes
/var/cache/rocm-cliand itsrocdxgsubdirectory are now reserved, root-owned staging paths that this plan resets (owner and mode, not contents) on every WSL driver install; nothing else should write there.- CI for this PR (head
ec42a59d) is fully green across the required jobs (clippy/test, E2E consolidated reports for Linux/Windows/WSL2/MI300X, security scans); no failing or pending required check at review time.
What this covered
Every file in the diff, read completely at pr-975-head via git show (never checked out): apps/rocm/src/driver_plan.rs, apps/rocm/src/driver_plan/rocdxg.rs (full file, including its test module), crates/rocm-core/src/diagnose/wsl.rs, crates/rocm-core/src/fix/catalog.rs, docs/architecture.md, docs/release-trust.md, docs/testing.md, docs/wsl.md (full file), skills/rocm-doctor/evals/fixtures/rocm-no-vendor-wsl-host-gpu-hidden-asks-which-gpu/replies.json, tests/e2e-cucumber/features/driver_install.feature, tests/e2e-cucumber/tests/e2e/driver_steps.rs; plus apps/rocm/src/driver_install.rs (not itself changed) to verify the executor actually stops at the first failing command rather than trusting the code comment that says so. Diff reviewed: 778c970f…ec42a59d.
Two of four code-pass groups (core driver_plan/rocdxg.rs logic; the diagnose/fix::catalog note wording) ran as independent background fan-out workers and returned clean (no findings). The other two groups (the docs bundle including docs/wsl.md's shell chaining; the e2e/unit test and fixture coverage) could not get a worker slot — the environment's concurrent-subagent limit was already saturated by unrelated sessions, and a retry also failed — so, per this method's rule for a failed spawn, I ran those two passes myself in this same context rather than silently absorbing the loss; they are not independent passes, and the blocking finding above came from one of them. A short design-review pass (concurrent-install collision, fixed-vs-unique filename, whether the opted-out-verification path still stages correctly) ran inline rather than as separate workers; its outputs are the three items under Decisions for the author. History and prior-review passes were minimal: git log on rocdxg.rs shows only the prior module-split refactor (#844), no rocdxg-specific history to review; no separate search of prior PR review comments on these files was performed. CI status pulled live via the GitHub API rather than assumed. Not reconciled against the PR's existing review thread during the blind pass; that thread (raising the same docs/wsl.md chaining point, among other non-blocking notes) was read only afterward, as this method requires, and is consistent with the independently-derived finding above.
🤖 Automated by an AI agent
| d="$(mktemp -d)" | ||
| curl -L --fail -o "$d/${ROCDXG_DEB}" \ | ||
| "https://github.com/ROCm/librocdxg/releases/download/v${ROCDXG_VERSION}/${ROCDXG_DEB}" | ||
| sudo install -m 0644 "$d/${ROCDXG_DEB}" "${ROCDXG_STAGED}" | ||
| rm -rf "$d" |
There was a problem hiding this comment.
Blocking (mechanical): These five lines (mktemp, curl, sudo install, rm -rf) are not chained with && to each other or to the sha256sum -c - block that follows, unlike that block's own internal chaining. Verified directly from the file text (not from any other review): if curl fails, the pasted script falls through to sudo install on a missing source (that also fails, noisily), then unconditionally rm -rf "$d", then starts the && chain at the digest check. On a first-time run this still fails closed (no file yet to check), but if a previously-verified .deb for the same version is already staged from an earlier successful run, the check re-passes against that leftover and the script proceeds to reinstall it — silently papering over the fact that this run's download never happened. The digest still gates apt install, so this isn't the TOCTOU hole the PR fixes a few lines below, but it's the same "pasted block keeps going after a failure" defect class this PR's own commands/tests guard against elsewhere (the generated plan's equivalent step in apps/rocm/src/driver_plan/rocdxg.rs chains download+copy with && and a trap ... EXIT). Suggest chaining these lines with && (and/or adding a trap 'rm -rf "$d"' EXIT for the private dir) to match the generated plan and the chained block below.
There was a problem hiding this comment.
Fixed in bcfe9b1 and 152b497. This is the same change as in the thread above. The download, the copy into the root-only directory, the check, the install, the removal and ldconfig are one && chain inside a subshell with trap 'rm -rf "$d"' EXIT. A failed curl therefore stops the block before the digest check, so a leftover staged copy cannot pass it and be reinstalled. wsl_doc_manual_steps_stop_before_the_check_when_the_download_fails runs the documented block and covers exactly that case: a good copy already staged plus a failed download means no install and a non-zero exit.
The manual steps chained the digest check, install, removal and ldconfig, but not the download and the copy into the root-only directory before them. Pasted into a shell, a failed download carried on to the check, and a copy an earlier run had left staged then passed it and was reinstalled as though this run had downloaded it. Every step up to ldconfig is now one `&&` chain, and the private download directory is removed by a last line that runs either way. A new test runs the documented block against stand-ins: with a good copy left staged and a download that fails, nothing is installed and the download directory is gone; a good download installs once. It fails against the previous block. Also note beside the plan-text assertion that the root:root owner reset is pinned there only, since the stand-in run cannot be root. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
The chained manual steps ended with a separate `rm -rf "$d"` line, so the block's exit status was always the cleanup's, and a failed download, digest check or install reported success to anything that ran the block as a script. The chain now runs in a subshell that removes the private download directory from an EXIT trap, as the generated plan does, so the block's status is the chain's. The test asserts that status for a failed download, a failed install and a good run, and the private directory's removal on each; it fails against the previous block, and against a block that swallows only the install's failure. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
|
Thanks for both reviews. The blocking point (the unchained download in the
main is merged in (7d14870) rather than rebased, since this PR has reviews. |
The test embedded docs/wsl.md with `include_str!`, which put the doc under the embedded-data ASCII contract, and its licence header is not ASCII. Read it from the repository at run time instead; `docs/` already selects the rocm tests in the pre-push hook. Signed-off-by: Roman Inflianskas <Roman.Inflianskas@amd.com>
juhovainio
left a comment
There was a problem hiding this comment.
Review — no blocking findings
Full review of the whole change at the current head (base bfff5216…head 16e5f64e), re-reviewed from scratch rather than narrowed, since the head advanced well past the last-reviewed commit (ec42a59d) through several commits including a merge of main. No ticket named; the PR's own checklist confirms there is none.
The previously-flagged blocking issue is fixed. docs/wsl.md's manual steps now wrap the whole download→check→install→cleanup sequence in one ( … ) subshell, every command &&-chained, with trap 'rm -rf "$d"' EXIT for the private download directory. Traced it line by line: a failed curl now stops the block before sha256sum -c runs, so a leftover from an earlier run is never silently rechecked and reinstalled, and the subshell's own exit status reflects the failure rather than reporting success. This matches the layout of the already-chained check/install/rm/ldconfig block below it.
Blocking
None
Non-blocking
- PR description's test explanation is stale on one mechanism —
wsl_doc_manual_steps_stop_before_the_check_when_the_download_failsis described in the PR body as extractingdocs/wsl.md"withinclude_str!", but the final commit (test(driver): read docs/wsl.md at run time in the manual-steps test) replaced that with a runtimefs::read_to_string(...)call, specifically to keep the doc's non-ASCII copyright header out of the embedded-data ASCII contract. The behavior the description claims (extracting and executing the manual block against stand-ins) is still accurate — only the stated mechanism is now wrong, and the body wasn't re-read after that last commit.
Confidence 85 · mechanical · Fix: a one-line wording update to the test's own bullet in the PR body.
Decisions for the author
- Ownership reset (
-o root -g root) is pinned only as a string, not exercised by root-owned behavior — answered-by-intent
PR body, "Not verified": "The owner reset (-o root -g root) is pinned as text only... The stand-in run cannot be root, so it proves the mode reset but not the ownership change." Confirmed independently: the mode-reset half (0777→0755) is genuinely exercised bywsl_rocdxg_generated_steps_install_exactly_the_verified_file, and the exact-o root -g rootsubstring is pinned by==equality (notcontains) in the other test, so a dropped flag would still be caught even though real ownership-changing behavior isn't. Reasonable, disclosed gap. - A package rejected by the digest check or
apt-getstays in/var/cache/rocm-cli/rocdxg/until the next same-version run;rocm uninstalldoesn't know about the directory — answered-by-intent
PR body, "Out of scope": "a rejected package can stay there until the next run of the same version... Teaching uninstall about root-owned driver leftovers is a separate change." Reasonable given the directory is root-only and inert between runs. - Fixed, version-keyed filename rather than a per-run unique one — answered-by-intent
PR body, "Out of scope": "Two installs of the same version racing on the fixed staged name are a non-goal too: only root can write that directory, so both racers would already have root." Sound given the directory's permissions are reset every run.
Positive signals
- The TOCTOU fix is real, not just claimed: the digest check and
apt-get installoperate on the exact same root-owned path (ROCDXG_STAGING_DIR/deb name) inrocdxg.rs, andinstallunconditionally overwrites that destination before the check runs, so a stale or planted file there is never what gets checked. wsl_rocdxg_generated_steps_install_exactly_the_verified_fileactually executes every generated step throughsh -cagainst stand-insudo/curl/install/apt-get/ldconfigbinaries, including acurlstand-in that fails if invoked undersudoor asked to write outside a private 0700 directory — this is a materially stronger test than asserting on substrings of the plan text, and would catch a regression that quietly pointed the digest check back at the private download directory.- Shell-injection guards on the interpolated version/digest strings (
rocdxg_version_is_well_formed,sha256_digest_is_well_formed) are backed by an adversarial test exercising;,&&, backticks,$(...), path traversal, and embedded newlines.
Deployment notes
/var/cache/rocm-cliand/var/cache/rocm-cli/rocdxgbecome reserved, root-owned staging paths that this plan resets (owner and mode, not contents) on every WSL driver install.- CI for this head (
16e5f64e) was still mostly pending at review time — the clippy/test gate and the WSL2 E2E lane (which exercises the new--dry-runscenario step) had not yet reported a result. Not a failure, but not yet confirmed green either; worth a final check before merge.
What this covered
Every file in the diff (11 files, bfff5216…16e5f64e), read completely. Code passes were split by coupling: (1) apps/rocm/src/driver_plan.rs + driver_plan/rocdxg.rs (plus driver_install.rs for executor fail-stop semantics) ran as an independent background worker, clean; (2) crates/rocm-core/src/diagnose/wsl.rs + fix/catalog.rs + the eval fixture ran as a second independent background worker, clean. Two further groups — the docs bundle (docs/wsl.md, architecture.md, release-trust.md, testing.md) and the e2e test/feature files — could not get a worker slot (the environment's concurrent-subagent limit was already saturated), so, per this method's rule for a failed spawn, I ran both myself in this same context; they are not independent passes. The agent-instruction-adherence pass (against this repo's AGENTS.md) and a history pass (git log/blame on rocdxg.rs, docs/wsl.md, fix/catalog.rs — no relevant prior history beyond a routine module-split refactor) were also run inline for the same reason, both clean.
Midway through, the shared git clone this review started in was found checked out to an unrelated branch by a different concurrent session; every finding above was verified (or re-verified) via content-addressed git show <sha>:path / git diff <sha> <sha> against the exact base and head commits, which is immune to that, rather than trusted from working-tree reads.
CI status pulled live rather than assumed. Not reconciled against the PR's existing review thread during the blind passes; that thread (which raised the same docs/wsl.md chaining point this review independently re-verified as fixed, plus the same three disclosed items above) was read only afterward, as this method requires, and is consistent with what was independently found here.
🤖 Automated by an AI agent
Problem
On WSL2,
rocm install driverdownloaded the ROCDXG.debto a fixed, predictable path in/tmp:/tmp/rocdxg-roct_<version>_amd64.deb. Any local user can write to that directory. The plan checked the file's SHA-256 there and then ransudo apt-get installon the same path, so another local user could create or replace the file between the digest check and the install. The package whose maintainer scripts then ran as root was not necessarily the one that passed the check. The manual steps indocs/wsl.mdhad the same layout, and also ransha256sum -candsudo apt installas separate lines, so a pasted block printedFAILEDon a mismatch and installed the package anyway.Fix
The WSL ROCDXG plan (
apps/rocm/src/driver_plan/rocdxg.rs) now:install -d -m 0755 -o root -g rooton/var/cache/rocm-cliand/var/cache/rocm-cli/rocdxgon every run. This also resets the owner and mode of either directory if it already exists. The parent matters too: whoever can write it could rename the staging directory and put their own in its place.sudointo a privatemktemp -ddirectory (unpredictable name, mode 0700, removed on exit), then copies it into the root-only directory withsudo install -m 0644. This is a single shell line, because each plan step runs as its ownsh -c.apt-get installon that same file, then removes it.The executor stops at the first failing step. A package rejected by the digest check or by
apt-gettherefore stays in the root-only directory, out of other users' reach, until the next run of the same version replaces it. When the CLI already runs as root, the plan leaves outsudoas before. Bare metal and native Windows are unchanged.User-visible changes:
rocm install driver --dry-runand review plan on WSL shows the new steps./var/cache/rocm-cli. It is reserved for root-owned driver staging. Each WSL driver install resets it and itsrocdxgsubdirectory to root:root 0755, leaving their contents alone.fix-wsl-3-rocdxg-missingnotes inrocm fixandrocm diagnosenow say the digest is checked on the root-placed copy that gets installed. The rocm-doctor eval fixture that records thisrocm fixoutput is regenerated to match.docs/wsl.mddescribes the root-only staging. Its manual steps follow the same layout, as one&&chain from the download toldconfiginside a subshell that removes the private download directory on exit. A failed download stops the block before the digest check, so a copy an earlier run left staged is never checked or reinstalled, and the block's exit status is the chain's, so a failed download, check or install does not report success.docs/release-trust.md,docs/testing.mdand thedocs/architecture.mdrow fordriver_plan/rocdxg.rsare updated too.Tests
wsl_rocdxg_plan_never_installs_from_a_path_another_user_can_write(unit). For both thesudoplan and the already-root plan, it checks that:/tmp, and the staged package sits under an allowlisted root-only system directory (/var/cache/), so moving it to another world-writable location such as/dev/shmor/var/tmpalso fails;install -dcommand for the staging directory and its parent comes first;mktemp -d, and only a rootinstallplaces the package;apt-getinstalls;sudo rm -f, orrm -fwhen already root), because the file is root-owned and an unprivilegedrmwould stop the plan beforeldconfig;It also checks the rendered
--dry-runplan.wsl_rocdxg_generated_steps_install_exactly_the_verified_file(unit, Unix). It runs every generated step, each in its ownsh -cas the CLI does, against stand-insudo,curl,install,apt-getandldconfig. Thecurlstand-in fails if it runs undersudoor writes anywhere other than a 0700 directory directly under$TMPDIR. Both staging directories start at 0777, so the 0755 the test asserts can only come from the plan resetting them. The test covers:apt-get;apt-getfailure, which leaves the package staged;wsl_doc_manual_steps_stop_before_the_check_when_the_download_fails(unit, Unix). It extracts the manual block fromdocs/wsl.mdwithinclude_str!and runs it against stand-ins. With a good copy already staged and a failing download, nothing is installed and the block exits non-zero; a failed install also exits non-zero; a good download installs once and exits zero; the private download directory is gone after each.Wording tests for the
rocm fixandrocm diagnosenotes. They only pin the text, and each one's comment names the test above as the one that proves the behaviour.Scenario
@id:driver-install-wsl-dry-run-plan(driver-install-01) gains the step "the driver plan installs only a package no other local user could have replaced". It checks the same layout on the realrocm install driver --dry-runoutput, including that the package is staged under/var/cache/. The scenario is tagged@requires-wsl, so it runs on theE2E tests (Strix Halo, WSL2)lane rather than in default CI.Each new unit test was shown to fail when the code it covers is broken. Seven mutations each turned at least one of them red:
/tmp/dev/shminstall -dstep (each of the two tests catches this on its own)curlrun undersudosudodropped from the cleanup stepmain(the tests no longer compile)The docs test fails against the earlier unchained manual block, against a chained block that ends in a separate
rm -rfline (exit status always 0), and against a block that swallows only the install's failure.The e2e step was not mutated, because it needs a WSL host. The swap itself was not staged on a real WSL host. The unit tests prove the layout and that the checked file is the installed file, not a timed race.
Verified locally (Linux, not WSL)
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningsandcargo clippy -p e2e-cucumber --test e2e -- -D warningscargo test -p rocm --bin rocm rocdxgandcargo test -p rocm --bin rocm wsl_doc, on the tree withmainmerged in, andcargo test -p rocm-core rocdxg_missing_notecargo xtask eval-fixtures --check,cargo xtask check-architecture-docandcargo xtask check-module-sizecargo test --workspace --all-targets --no-fail-fast, run withTMPDIRon an exec filesystem because this host's/tmpisnoexec. The only failures were the eval-fixture check (since fixed and re-run green) and three tests in files this change does not touch: twobuild_metadatatests that create scratch git commits, which this host's global commit signing rejects, andservice_control::stop_of_a_container_engine_is_unconfirmed_when_the_engine_stop_fails, which depends on the host'sdocker.Not verified
@id:driver-install-wsl-dry-run-planwas not run locally, because no WSL host was available. The WSL2 CI lane runs it.rocm install driver --yeson WSL2 was not run.cargo xtask smokewas not run to completion. It stops at the bubblewrap sandbox step, which this host can't run.-o root -g root) is pinned as text only. The stand-in run cannot be root, so it proves the mode reset but not the ownership change.Out of scope
rocm uninstalldoesn't mention/var/cache/rocm-cli/. After a successful install that directory is empty, but a rejected package can stay there until the next run of the same version.docs/wsl.mdgives the one-line cleanup. Teaching uninstall about root-owned driver leftovers is a separate change. Two installs of the same version racing on the fixed staged name are a non-goal too: only root can write that directory, so both racers would already have root.tests/e2e-cucumber/expectations.tomlfor the fixed ticket ID and removed/narrowed any now-stale xfail rows. (No ticket ID; no xfail row covers the ROCDXG plan.)docs/architecture.md. (No new subcommand or subsystem.)docs/architecture.mdhas the matching entry, and the prose of any entry whose file changed role still describes it. (No files added or removed; thedriver_plan/rocdxg.rsrow now describes the root-only staging.)wsl_rocdxg_generated_steps_install_exactly_the_verified_file, which executes the plan.)