Update library/std/src/sys/pal/common/exit_guard.rs · model-checking/verify-rust-std@cf300a7 (original) (raw)

`@@ -2,12 +2,14 @@ cfg_if::cfg_if! {

`

2

2

`if #[cfg(target_os = "linux")] {

`

3

3

`/// Mitigation for https://github.com/rust-lang/rust/issues/126600

`

4

4

`///

`

5

``

`` -

/// On UNIX-like platforms (where libc::exit may not be thread-safe), ensure that only one

``

``

5

`` +

/// On glibc, libc::exit has been observed to not always be thread-safe.

``

``

6

`+

/// It is currently unclear whether that is a glibc bug or allowed by the standard.

`

``

7

`+

/// To mitigate this problem, we ensure that only one

`

6

8

`` /// Rust thread calls libc::exit (or returns from main) by calling this function before

``

7

9

`` /// calling libc::exit (or returning from main).

``

8

10

`///

`

9

``

`-

/// Technically not enough to ensure soundness, since other code directly calling

`

10

``

`-

/// libc::exit will still race with this.

`

``

11

`+

/// Technically, this is not enough to ensure soundness, since other code directly calling

`

``

12

`` +

/// libc::exit will still race with this.

``

11

13

`///

`

12

14

`` /// This function does not itself call libc::exit. This is so it can also be used

``

13

15

`` /// to guard returning from main.

``