Commit 0cec4a1
Restore getrandom(2) path for Linux with glibc 2.36 or later
This is a follow-up to commit b120f5e (avoid fork-unsafe arc4random
implementations, 2018-09-04).
Avoid defining a no-op fill_random_bytes_syscall() if arc4random_buf(3)
exists, but we are unsure if it is fork-safe. Check for other options
instead. IOW, see if getrandom(2) is available.
glibc 2.36, released in 2022, started to provide arc4random_buf(3) on
Linux. This causes fill_random_bytes_syscall() to use neither of them
and makes Random.urandom solely rely on getentropy(3) via
fill_random_bytes_urandom().
While the glibc implementation is safe, I did not add it to the list
because using getrandom(2) directly is preferable on Linux.1 parent 1181a68 commit 0cec4a1
1 file changed
+5
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
554 | 554 | | |
555 | 555 | | |
556 | 556 | | |
557 | | - | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
558 | 562 | | |
559 | 563 | | |
560 | 564 | | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | 565 | | |
565 | 566 | | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | 567 | | |
570 | 568 | | |
571 | 569 | | |
| |||
0 commit comments