Repository navigation
uefi: roll back env changes when start_image fails - #164958
Merged
rust-bors[bot] merged 1 commit intoOct 26, 2026
Merged
rust-bors[bot] merged 1 commit into
rust-bors[bot] merged 1 commit into
Conversation
`process::output` on UEFI applies the child's environment changes to the process-global UEFI environment and restores them after `start_image`. If `start_image` returned an error, the `?` returned early before the rollback ran, leaking the child's variables (e.g. `path`) into the parent. Restore the environment unconditionally and only then propagate the error.
Collaborator
|
Thanks for the pull request, and welcome! The Rust Project has assigned @Mark-Simulacrum (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
Member
|
Thanks! |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Oct 26, 2026
…n-spawn-failure, r=joboet uefi: roll back env changes when `start_image` fails Fixes rust-lang#164949 On UEFI, `process::output` applies the child's environment changes to the process-global UEFI environment and rolls them back after `start_image`. If `start_image` returned an error, the `?` returned early before the rollback ran, so the child's variables (notably `path`, which later `resolve_program` lookups depend on) leaked permanently into the parent. This keeps the `start_image` result, restores the environment unconditionally, and only then propagates the error. Tested with `./x check library --target x86_64-unknown-uefi`, `./x fmt --check` and `./x test tidy`. I have not run it on UEFI hardware or under QEMU. cc @dvdhrm @nicholasbishop (UEFI target maintainers)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 26, 2026
…uwer Rollup of 8 pull requests Successful merges: - #164955 (Use the updated buffer length in UEFI locate_handles) - #164958 (uefi: roll back env changes when `start_image` fails) - #164968 (thread_local::guard: update comments a bit) - #164303 (Remove the 'sub' method from 'At' and migrate to 'sub_raw') - #164674 (Use a NoSpan marker for region constraints without spans) - #164856 (Switch from `insta` to `expect-test` in bootstrap) - #164934 (Remove redundant vec and duplicate indexing in find_noop_landing_pads) - #164954 (Reduce `SpanData` use)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 26, 2026
…uwer Rollup of 8 pull requests Successful merges: - #164955 (Use the updated buffer length in UEFI locate_handles) - #164958 (uefi: roll back env changes when `start_image` fails) - #164968 (thread_local::guard: update comments a bit) - #164303 (Remove the 'sub' method from 'At' and migrate to 'sub_raw') - #164674 (Use a NoSpan marker for region constraints without spans) - #164934 (Remove redundant vec and duplicate indexing in find_noop_landing_pads) - #164954 (Reduce `SpanData` use) - #164970 (`rust-analyzer` subtree update)
rust-bors Bot
pushed a commit
that referenced
this pull request
Oct 26, 2026
Rollup merge of #164958 - Web4everyone32:uefi-env-rollback-on-spawn-failure, r=joboet uefi: roll back env changes when `start_image` fails Fixes #164949 On UEFI, `process::output` applies the child's environment changes to the process-global UEFI environment and rolls them back after `start_image`. If `start_image` returned an error, the `?` returned early before the rollback ran, so the child's variables (notably `path`, which later `resolve_program` lookups depend on) leaked permanently into the parent. This keeps the `start_image` result, restores the environment unconditionally, and only then propagates the error. Tested with `./x check library --target x86_64-unknown-uefi`, `./x fmt --check` and `./x test tidy`. I have not run it on UEFI hardware or under QEMU. cc @dvdhrm @nicholasbishop (UEFI target maintainers)
ettolrach
pushed a commit
to ettolrach/rustfmt
that referenced
this pull request
Nov 4, 2026
…uwer Rollup of 8 pull requests Successful merges: - rust-lang/rust#164955 (Use the updated buffer length in UEFI locate_handles) - rust-lang/rust#164958 (uefi: roll back env changes when `start_image` fails) - rust-lang/rust#164968 (thread_local::guard: update comments a bit) - rust-lang/rust#164303 (Remove the 'sub' method from 'At' and migrate to 'sub_raw') - rust-lang/rust#164674 (Use a NoSpan marker for region constraints without spans) - rust-lang/rust#164934 (Remove redundant vec and duplicate indexing in find_noop_landing_pads) - rust-lang/rust#164954 (Reduce `SpanData` use) - rust-lang/rust#164970 (`rust-analyzer` subtree update)
weirdsmiley
pushed a commit
to weirdsmiley/rust-analyzer
that referenced
this pull request
Nov 9, 2026
…uwer Rollup of 8 pull requests Successful merges: - rust-lang/rust#164955 (Use the updated buffer length in UEFI locate_handles) - rust-lang/rust#164958 (uefi: roll back env changes when `start_image` fails) - rust-lang/rust#164968 (thread_local::guard: update comments a bit) - rust-lang/rust#164303 (Remove the 'sub' method from 'At' and migrate to 'sub_raw') - rust-lang/rust#164674 (Use a NoSpan marker for region constraints without spans) - rust-lang/rust#164934 (Remove redundant vec and duplicate indexing in find_noop_landing_pads) - rust-lang/rust#164954 (Reduce `SpanData` use) - rust-lang/rust#164970 (`rust-analyzer` subtree update)
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.
Fixes #164949
On UEFI,
process::outputapplies the child's environment changes to the process-global UEFI environment and rolls them back afterstart_image. Ifstart_imagereturned an error, the?returned early before the rollback ran, so the child's variables (notablypath, which laterresolve_programlookups depend on) leaked permanently into the parent.This keeps the
start_imageresult, restores the environment unconditionally, and only then propagates the error.Tested with
./x check library --target x86_64-unknown-uefi,./x fmt --checkand./x test tidy. I have not run it on UEFI hardware or under QEMU.cc @dvdhrm @nicholasbishop (UEFI target maintainers)