std: refactor UNIX stack overflow code - #162296
Open
joboet wants to merge 1 commit into
Open
Conversation
Collaborator
|
Any special-casing of Miri in the standard library requires review. cc @rust-lang/miri |
Collaborator
|
r? @ChrisDenton rustbot has assigned @ChrisDenton. Use Why was this reviewer chosen?The reviewer was selected based on:
|
RalfJung
reviewed
Sep 4, 2026
joboet
force-pushed
the
refactor_stack_overflow
branch
from
September 4, 2026 17:42
305f083 to
f8cd163
Compare
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
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.
The idea here is to split the code up into two main areas:
install_main_guardinstalls the main thread's guard pagefind_main_guard(new) finds the guard page the system has set up for the main thread (this was previously mashed in withinstall_main_guard)current_guardfinds the guard page of the current (non-main) threadSplitting the guard page stuff out will allow us to enable the soundness-critical guard page install logic even if the system doesn't support signals; and also makes it easier to work on the individual areas in parallel.
Unfortunately this isn't as simple as moving the code around: the current code caches the system's page size in a
PAGE_SIZEatomic, but that atomic is not always accessed. Thus there are some non-functional changes here in regards to how the page size is passed around. Also, since the guard page code now needs to compile on all systems, thecfg!()-based switching used to simplify cross-platform code checking would necessitate some stub implementations, so I've switched to propercfg_select!based logic.These kinds of code moves don't display nicely in the diff unfortunately, let me know if there's anything I can do to help with the review!