-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Stack overflow not caught in Drop for TLS data #111272
Copy link
Copy link
Open
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsA-stack-probeArea: Stack probing and guard pagesArea: Stack probing and guard pagesA-threadArea: `std::thread`Area: `std::thread`A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.
Metadata
Metadata
Assignees
Labels
A-runtimeArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsArea: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflowsA-stack-probeArea: Stack probing and guard pagesArea: Stack probing and guard pagesA-threadArea: `std::thread`Area: `std::thread`A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Rust attempts to catch stack overflow by installing a guard page at the end of the valid stack range. This guard page is stored in TLS and is torn down when a thread exits (including the main thread).
However other thread local data may run
dropafter this guard page is torn down. Stack overflows occurring in thesedropimplementations are not detected by Rust. (It may be backstopped by the OS, but this is system dependent.)To reproduce:
This causes a
SIGILLon macOS and aSIGSEGVon Linux. In both cases I confirmed that Rust's stack overflow signal handler is not run.Reproduced on rust stable and master branch.