rust/library/std
Manish Goregaokar eb860987cf
Rollup merge of #88828 - FabianWolff:issue-88585, r=dtolnay
Use `libc::sigaction()` instead of `sys::signal()` to prevent a deadlock

Fixes #88585. POSIX [specifies](https://man7.org/linux/man-pages/man3/fork.3p.html) that after forking,
> to avoid errors, the child process may only execute async-signal-safe operations until such time as one of the exec functions is called.

Rust's standard library does not currently adhere to this, as evidenced by #88585. The child process calls [`sys::signal()`](7bf0736e13/library/std/src/sys/unix/android.rs (L76)), which on Android calls [`libc::dlsym()`](7bf0736e13/library/std/src/sys/unix/weak.rs (L101)), which is [**not**](https://man7.org/linux/man-pages/man7/signal-safety.7.html) async-signal-safe, and in fact causes a deadlock in the example in #88585.

I think the easiest solution here would be to just call `libc::sigaction()` instead, which [is](https://man7.org/linux/man-pages/man7/signal-safety.7.html) async-signal-safe, provides the functionality we need, and is apparently available on all Android versions because it is also used e.g. [here](7bf0736e13/library/std/src/sys/unix/stack_overflow.rs (L112-L114)).
2021-10-05 12:52:42 -07:00
..
benches
primitive_docs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
src Rollup merge of #88828 - FabianWolff:issue-88585, r=dtolnay 2021-10-05 12:52:42 -07:00
tests Update aarch64 runtime feature detection tests 2021-08-03 12:07:56 +00:00
build.rs Add SOLID targets 2021-09-28 11:31:47 +09:00
Cargo.toml Expose the std_detect env_override feature 2021-09-25 20:30:25 +02:00