mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 1726474 - Preload rlbox library on all platforms. r=nika
Notably, on Windows, the sequences of loading/unloading in child processes trigger https://searchfox.org/mozilla-central/rev/d3683dbb252506400c71256ef3994cdbdfb71ada/toolkit/xre/dllservices/UntrustedModulesData.cpp#324 Differential Revision: https://phabricator.services.mozilla.com/D123039
This commit is contained in:
parent
5c13a00393
commit
2829072aeb
@ -27,10 +27,15 @@ PathString GetSandboxedRLBoxPath() {
|
||||
return libFile->NativePath();
|
||||
}
|
||||
|
||||
PRLibrary* PreloadLibrary(const nsCString& path) {
|
||||
PRLibrary* PreloadLibrary(const PathString& path) {
|
||||
PRLibSpec libSpec;
|
||||
#ifdef XP_WIN
|
||||
libSpec.type = PR_LibSpec_PathnameU;
|
||||
libSpec.value.pathname_u = path.get();
|
||||
#else
|
||||
libSpec.type = PR_LibSpec_Pathname;
|
||||
libSpec.value.pathname = path.get();
|
||||
#endif
|
||||
PRLibrary* ret = PR_LoadLibraryWithFlags(libSpec, PR_LD_LAZY);
|
||||
return ret;
|
||||
}
|
||||
@ -38,9 +43,9 @@ PRLibrary* PreloadLibrary(const nsCString& path) {
|
||||
void PreloadSandboxedDynamicLibrary() {
|
||||
// The process level sandbox does not allow loading of dynamic libraries.
|
||||
// This preloads wasm sandboxed libraries before the process level sandbox is
|
||||
// enabled. Currently, this is only needed for Linux as Mac allows loading
|
||||
// libraries from the package file.
|
||||
#if defined(XP_LINUX) && defined(MOZ_USING_WASM_SANDBOXING)
|
||||
// enabled. Technically, this is only needed for Linux, but also allows to
|
||||
// avoid loading/unloading the library repeatedly on other platforms.
|
||||
#if defined(MOZ_USING_WASM_SANDBOXING)
|
||||
if (!PreloadLibrary(GetSandboxedRLBoxPath())) {
|
||||
MOZ_CRASH("Library preload failure: Failed to load librlbox\n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user