File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed
library/std/src/sys/pal/unix Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,18 @@ mod imp {
106106 // supported on the current kernel.
107107 //
108108 // Also fall back in case it is disabled by something like
109- // seccomp or inside of virtual machines.
109+ // seccomp or inside of docker.
110+ //
111+ // If the `getrandom` syscall is not implemented in the current kernel version it should return an
112+ // `ENOSYS` error. Docker also blocks the whole syscall inside unprivileged containers, and
113+ // returns `EPERM` (instead of `ENOSYS`) when a program tries to invoke the syscall. Because of
114+ // that we need to check for *both* `ENOSYS` and `EPERM`.
115+ //
116+ // Note that Docker's behavior is breaking other projects (notably glibc), so they're planning
117+ // to update their filtering to return `ENOSYS` in a future release:
118+ //
119+ // https://github.com/moby/moby/issues/42680
120+ //
110121 GETRANDOM_UNAVAILABLE . store ( true , Ordering :: Relaxed ) ;
111122 return false ;
112123 } else if err == libc:: EAGAIN {
Original file line number Diff line number Diff line change @@ -16,16 +16,6 @@ fn has_clone3() -> bool {
1616 . then ( || Error :: last_os_error ( ) )
1717 . expect ( "probe syscall should not succeed" ) ;
1818
19- // If the `clone3` syscall is not implemented in the current kernel version it should return an
20- // `ENOSYS` error. Docker also blocks the whole syscall inside unprivileged containers, and
21- // returns `EPERM` (instead of `ENOSYS`) when a program tries to invoke the syscall. Because of
22- // that we need to check for *both* `ENOSYS` and `EPERM`.
23- //
24- // Note that Docker's behavior is breaking other projects (notably glibc), so they're planning
25- // to update their filtering to return `ENOSYS` in a future release:
26- //
27- // https://github.com/moby/moby/issues/42680
28- //
2919 err. raw_os_error ( ) != Some ( libc:: ENOSYS ) && err. raw_os_error ( ) != Some ( libc:: EPERM )
3020}
3121
You can’t perform that action at this time.
0 commit comments