rust/library/std/src/sys/pal
Matthias Krüger 2ee3668ad5
Rollup merge of #127843 - workingjubilee:break-up-big-ass-stack-overflow-fn, r=joboet
unix: document unsafety for std `sig{action,altstack}`

I found many surprising elements here while trying to wrap a measly 5 functions with `unsafe`. I would rather not "just" mindlessly wrap this code with `unsafe { }`, so I decided to document it properly.

On Unix, this code covers the "create and setup signal handler" part of the stack overflow code, and serves as the primary safety boundary for the signal handler. It is rarely audited, very gnarly, and worth extra attention. It calls other unsafe functions defined in this module, but "can we correctly map the right memory, or find the right address ranges?" are separate questions, and get increasingly platform-specific. The question here is the more general "are we doing everything in the correct order, and setting up the handler in the correct way?"

As part of this audit, I noticed that we do some peculiar things that we should probably refrain from. However, I avoided making changes that I deemed might have a different final result in Rust programs. I did, however, reorder some events so that the signal handler is installed _after_ we install the alternate stack. We do not run much code between these events, but it is probably best if the timespan between the handler being available and the new stack being installed is 0 nanoseconds.
2024-07-20 13:24:53 +02:00
..
common Move exit guard from sys::common::exit_guard to sys::exit_guard. 2024-07-05 17:01:08 -05:00
hermit Use futex.rs for Windows thread parking 2024-07-16 11:21:51 +00:00
itron Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum 2024-06-24 15:55:28 +00:00
sgx std: refactor the TLS implementation 2024-06-15 17:47:35 +02:00
solid Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum 2024-06-24 15:55:28 +00:00
teeos deny unsafe_op_in_unsafe_fn for teeos 2024-07-16 11:47:22 +08:00
uefi uefi: process: Fixes from PR 2024-07-19 17:44:27 +05:30
unix Rollup merge of #127843 - workingjubilee:break-up-big-ass-stack-overflow-fn, r=joboet 2024-07-20 13:24:53 +02:00
unsupported Auto merge of #126523 - joboet:the_great_big_tls_refactor, r=Mark-Simulacrum 2024-06-24 15:55:28 +00:00
wasi Avoid comments that describe multiple use items. 2024-07-17 08:02:46 +10:00
wasip2 Avoid comments that describe multiple use items. 2024-07-17 08:02:46 +10:00
wasm Use futex.rs for Windows thread parking 2024-07-16 11:21:51 +00:00
windows feat: adding ext that returns change_time for Windows 2024-07-17 13:34:18 -07:00
xous xous: Forbid unwrapped unsafe in platform modules 2024-07-16 16:16:03 -07:00
zkvm zkvm: add #[forbid(unsafe_op_in_unsafe_fn)] in stdlib 2024-07-16 16:04:02 -07:00
mod.rs std: removes logarithms family function edge cases handling for solaris. 2024-07-14 23:20:46 +01:00