diff options
| author | Askar Safin <safinaskar@gmail.com> | 2024-01-24 15:22:00 +0300 |
|---|---|---|
| committer | Askar Safin <safinaskar@gmail.com> | 2024-01-24 15:22:00 +0300 |
| commit | 57f9d1f01a6b249c6673e6da253c3504ce8ce4c4 (patch) | |
| tree | 78b01a8b46049e2ea21ba1724f3dae0cfae98a00 /library/std/src/sys | |
| parent | f6ee4bf3847277d6d6e2007ff664f8ea0895b11b (diff) | |
This commit is part of clone3 clean up. As part of clean up we will
remove tests/ui/command/command-create-pidfd.rs . But it contains very useful comment, so let's move the comment to library/std/src/sys/pal/unix/rand.rs , which contains another instance of the same Docker problem
Diffstat (limited to 'library/std/src/sys')
| -rw-r--r-- | library/std/src/sys/pal/unix/rand.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/library/std/src/sys/pal/unix/rand.rs b/library/std/src/sys/pal/unix/rand.rs index cf0fe0f47c5..1dba1ccf64e 100644 --- a/library/std/src/sys/pal/unix/rand.rs +++ b/library/std/src/sys/pal/unix/rand.rs @@ -106,7 +106,18 @@ mod imp { // supported on the current kernel. // // Also fall back in case it is disabled by something like - // seccomp or inside of virtual machines. + // seccomp or inside of docker. + // + // If the `getrandom` syscall is not implemented in the current kernel version it should return an + // `ENOSYS` error. Docker also blocks the whole syscall inside unprivileged containers, and + // returns `EPERM` (instead of `ENOSYS`) when a program tries to invoke the syscall. Because of + // that we need to check for *both* `ENOSYS` and `EPERM`. + // + // Note that Docker's behavior is breaking other projects (notably glibc), so they're planning + // to update their filtering to return `ENOSYS` in a future release: + // + // https://github.com/moby/moby/issues/42680 + // GETRANDOM_UNAVAILABLE.store(true, Ordering::Relaxed); return false; } else if err == libc::EAGAIN { |
