Increase the size of the sigaltstack.#1315
Merged
alexcrichton merged 6 commits intomasterfrom Apr 3, 2020
Merged
Conversation
Rust's stack overflow handler installs a sigaltstack stack with size SIGSTKSZ, which is too small for some of the things we do in signal handlers, and as of this writing lacks a guard page. Install bigger sigaltstack stacks so that we have enough space, and have a guard page.
Subscribe to Label ActionThis issue or pull request has been labeled: "wasmtime:api" Users Subscribed to "wasmtime:api"To subscribe or unsubscribe from this label, edit the |
iximeow
reviewed
Mar 13, 2020
ghost
reviewed
Mar 25, 2020
|
|
||
| /// The size of the sigaltstack (not including the guard, which will be added). | ||
| /// Make this large enough to run our signal handlers. | ||
| static STACK_SIZE: usize = libc::SIGSTKSZ * 4; |
There was a problem hiding this comment.
FYI in Dfinity we use std::cmp::max(SIGSTKSZ, 24 * 1024) here, because SIGSTKSZ on MacOS is already huge (128K) and reserving 512K per thread for the signal stack seemed like too much
This was referenced Mar 30, 2020
sunfishcode
commented
Apr 3, 2020
Member
Author
sunfishcode
left a comment
There was a problem hiding this comment.
Github won't let me approve since it was originally my PR, but this LGTM.
| return Err(Trap::oom()); | ||
| } | ||
|
|
||
| // Prepare the stack with readable/writable memory and then reigster it |
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.
Rust's stack overflow handler installs a sigaltstack stack with size
SIGSTKSZ, which is too small for some of the things we do in signal
handlers, and as of this writing lacks a guard page. Install bigger
sigaltstack stacks so that we have enough space, and have a guard page.
This is similar to #1298 but rewritten in Rust