Bug 1948620: Part 2 - Use library names for rlbox_wasm2c memory allocations r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D241897
This commit is contained in:
Shravan Narayan
2025-03-21 03:44:43 +00:00
parent 0943dcb9eb
commit e4a8b56009
6 changed files with 19 additions and 6 deletions

View File

@@ -87,7 +87,9 @@ OggDemuxer::nsAutoOggSyncState::~nsAutoOggSyncState() {
rlbox_sandbox_ogg* OggDemuxer::CreateSandbox() {
rlbox_sandbox_ogg* sandbox = new rlbox_sandbox_ogg();
#ifdef MOZ_WASM_SANDBOXING_OGG
bool success = sandbox->create_sandbox(false /* infallible */);
bool success = sandbox->create_sandbox(/* shouldAbortOnFailure = */ false,
/* custom capacity = */ nullptr,
"rlbox_wasm2c_ogg");
#else
bool success = sandbox->create_sandbox();
#endif

View File

@@ -57,8 +57,8 @@ RLBoxHunspell* RLBoxHunspell::Create(const nsCString& affpath,
const w2c_mem_capacity capacity = get_valid_wasm2c_memory_capacity(
expectedMaxMemory, true /* wasm's 32-bit memory */);
bool success =
sandbox->create_sandbox(/* shouldAbortOnFailure = */ false, &capacity);
bool success = sandbox->create_sandbox(/* shouldAbortOnFailure = */ false,
&capacity, "rlbox_wasm2c_hunspell");
#elif defined(MOZ_WASM_SANDBOXING_HUNSPELL)
bool success = sandbox->create_sandbox(/* shouldAbortOnFailure = */ false);
#else

View File

@@ -57,7 +57,8 @@ UniquePtr<RLBoxSandboxDataBase> RLBoxWOFF2SandboxPool::CreateSandboxData(
#if defined(MOZ_WASM_SANDBOXING_WOFF2)
const w2c_mem_capacity capacity =
get_valid_wasm2c_memory_capacity(aSize, true /* 32-bit wasm memory*/);
bool createOK = sandbox->create_sandbox(/* infallible = */ false, &capacity);
bool createOK = sandbox->create_sandbox(/* shouldAbortOnFailure = */ false,
&capacity, "rlbox_wasm2c_woff2");
#else
bool createOK = sandbox->create_sandbox();
#endif

View File

@@ -655,7 +655,13 @@ struct gfxFontEntry::GrSandboxData {
grGetGlyphAdvanceCallback;
GrSandboxData() {
#if defined(MOZ_WASM_SANDBOXING_GRAPHITE)
sandbox.create_sandbox(/* shouldAbortOnFailure = */ true,
/* custom capacity = */ nullptr,
"rlbox_wasm2c_graphite");
#else
sandbox.create_sandbox();
#endif
grGetTableCallback =
sandbox.register_callback(gfxFontEntryCallbacks::GrGetTable);
grReleaseTableCallback =

View File

@@ -14,7 +14,10 @@ RLBoxSoundTouch::RLBoxSoundTouch() {}
bool RLBoxSoundTouch::Init() {
#ifdef MOZ_WASM_SANDBOXING_SOUNDTOUCH
const bool success = mSandbox.create_sandbox(false /* infallible */);
const bool success = mSandbox.create_sandbox(
/* shouldAbortOnFailure = */ false,
/* custom capacity = */ nullptr,
"rlbox_wasm2c_soundtouch");
#else
const bool success = true;
mSandbox.create_sandbox();

View File

@@ -1450,7 +1450,8 @@ RLBoxExpatSandboxPool::CreateSandboxData(uint64_t aSize) {
#ifdef MOZ_WASM_SANDBOXING_EXPAT
const w2c_mem_capacity capacity =
get_valid_wasm2c_memory_capacity(aSize, true /* 32-bit wasm memory*/);
bool create_ok = sandbox->create_sandbox(/* infallible = */ false, &capacity);
bool create_ok = sandbox->create_sandbox(/* shouldAbortOnFailure = */ false,
&capacity, "rlbox_wasm2c_expat");
#else
bool create_ok = sandbox->create_sandbox();
#endif