Ensure urandom FD is warmed before zygote fork
We use base::RandUint64 to warm the urandom FD on POSIX, ensuring it's open by the time the zygote forks. This was broken by https://chromium-review.googlesource.com/c/chromium/src/+/2380673 which results in RandUint64 generally not opening urandom. To avoid the issue, this CL explicitly calls base::GetUrandomFD() instead of RandUint64 during pre-zygote init. This way, if RandBytes needs to fall back onto urandom in a sandboxed process, it won't fail. Fixed: 1141593 Change-Id: I36996fafea79170e7c3dddb219695e88b8213033 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2492942 Reviewed-by: Chris Palmer <palmer@chromium.org> Commit-Queue: Chris Palmer <palmer@chromium.org> Commit-Queue: Ken Rockot <rockot@google.com> Auto-Submit: Ken Rockot <rockot@google.com> Cr-Commit-Position: refs/heads/master@{#820016}
This commit is contained in:
@ -72,7 +72,7 @@ base::OnceClosure ClosureFromTwoClosures(base::OnceClosure one,
|
||||
// This function triggers the static and lazy construction of objects that need
|
||||
// to be created before imposing the sandbox.
|
||||
static void ZygotePreSandboxInit() {
|
||||
base::RandUint64();
|
||||
base::GetUrandomFD();
|
||||
|
||||
base::SysInfo::AmountOfPhysicalMemory();
|
||||
base::SysInfo::NumberOfProcessors();
|
||||
|
Reference in New Issue
Block a user