зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1614933 - Ensure that glibc's lazy initializers run before we enable the content process sandbox on Linux; r=jld
Differential Revision: https://phabricator.services.mozilla.com/D63471 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2ed0dc6ea9
Коммит
49040b8671
|
@ -27,6 +27,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
@ -500,6 +501,14 @@ void SandboxEarlyInit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void RunGlibcLazyInitializers() {
|
||||||
|
// Make glibc's lazy initialization of shm_open() run before sandboxing
|
||||||
|
int fd = shm_open("/dummy", O_RDONLY, 0);
|
||||||
|
if (fd > 0) {
|
||||||
|
close(fd); // In the unlikely case we actually opened something
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void SandboxLateInit() {
|
static void SandboxLateInit() {
|
||||||
#ifdef NIGHTLY_BUILD
|
#ifdef NIGHTLY_BUILD
|
||||||
gSandboxCrashOnError = true;
|
gSandboxCrashOnError = true;
|
||||||
|
@ -516,6 +525,8 @@ static void SandboxLateInit() {
|
||||||
gSandboxCrashOnError = envVar[0] != '0';
|
gSandboxCrashOnError = envVar[0] != '0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RunGlibcLazyInitializers();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common code for sandbox startup.
|
// Common code for sandbox startup.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче