Fix observable intermediate state in thread::add_spawn_hook#159956
Open
maxdexh wants to merge 2 commits into
Open
Fix observable intermediate state in thread::add_spawn_hook#159956maxdexh wants to merge 2 commits into
thread::add_spawn_hook#159956maxdexh wants to merge 2 commits into
Conversation
Collaborator
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Contributor
Author
This doesn't touch the compiler? |
Contributor
|
I guess all of the compiler is r? libs |
Contributor
Author
|
Thanks ^^ |
Member
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 27, 2026
…23, r=Mark-Simulacrum Fix observable intermediate state in `thread::add_spawn_hook` Fixes rust-lang#159923. Ensures the intermediate state of there being no hooks in `add_spawn_hooks` is not observable by allocating the new head node before taking the current hook list. Also added a note to the docs of `add_spawn_hook` that hooks are not guaranteed to run and cannot be relied upon for soundness, as there are multiple ways to prevent all/some hooks from running.
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 27, 2026
…uwer Rollup of 8 pull requests Successful merges: - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - #159554 (feat: Update method signature of int_from_ascii) - #159637 (Some place analysis tweaks) - #159961 (sanitize_standard_fds: Miri supports poll now) - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
rust-bors Bot
pushed a commit
that referenced
this pull request
Jul 27, 2026
…uwer Rollup of 8 pull requests Successful merges: - #159085 (Fix decoding attributes of `SyntheticCoroutineBody`) - #159554 (feat: Update method signature of int_from_ascii) - #159637 (Some place analysis tweaks) - #159961 (sanitize_standard_fds: Miri supports poll now) - #159967 (rustc_target: callconv: mips64: Return structs with single f128 in FPRs) - #159253 (Add suggestions for using `#[export_name]` instead of `#[link_name]` on static) - #159840 (Fix opaque type ICE in late lints under the next-generation trait solver) - #159956 (Fix observable intermediate state in `thread::add_spawn_hook`)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 27, 2026
…23, r=Mark-Simulacrum Fix observable intermediate state in `thread::add_spawn_hook` Fixes rust-lang#159923. Ensures the intermediate state of there being no hooks in `add_spawn_hooks` is not observable by allocating the new head node before taking the current hook list. Also added a note to the docs of `add_spawn_hook` that hooks are not guaranteed to run and cannot be relied upon for soundness, as there are multiple ways to prevent all/some hooks from running.
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Jul 27, 2026
…23, r=Mark-Simulacrum Fix observable intermediate state in `thread::add_spawn_hook` Fixes rust-lang#159923. Ensures the intermediate state of there being no hooks in `add_spawn_hooks` is not observable by allocating the new head node before taking the current hook list. Also added a note to the docs of `add_spawn_hook` that hooks are not guaranteed to run and cannot be relied upon for soundness, as there are multiple ways to prevent all/some hooks from running.
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 #159923.
Ensures the intermediate state of there being no hooks in
add_spawn_hooksis not observable by allocating the new head node before taking the current hook list.Also added a note to the docs of
add_spawn_hookthat hooks are not guaranteed to run and cannot be relied upon for soundness, as there are multiple ways to prevent all/some hooks from running.