Bug 1736171 - Update wasm2c fork to fix hunspell crash when accessing top half of heap r=bholley

Differential Revision: https://phabricator.services.mozilla.com/D129976
This commit is contained in:
shravanrn@gmail.com 2021-10-31 21:28:06 +00:00
parent 1f575204d8
commit 011ed92913
5 changed files with 14 additions and 4 deletions

View File

@ -9,8 +9,8 @@ origin:
description: wasm2c fork used for rlbox sandboxing
url: https://github.com/PLSysSec/wasm2c_sandbox_compiler
release: commit 247bd88bd77f07e3447ee168ed26d815de47b077 (2021-10-26T04:00:27Z).
revision: 247bd88bd77f07e3447ee168ed26d815de47b077
release: commit cd4b501b775244535603baa22c349bf0e3d11844 (2021-10-31T04:46:54Z).
revision: cd4b501b775244535603baa22c349bf0e3d11844
license: Apache-2.0
license-file: LICENSE

View File

@ -87,7 +87,7 @@ const char SECTION_NAME(declarations)[] =
"\n"
"#if defined(WASM_USE_GUARD_PAGES) && UINTPTR_MAX == 0xffffffff\n"
"// on 32-bit platforms we have to mask memory access into range\n"
"# define MEM_ACCESS_REF(mem, addr) &mem->data[addr & 0x7fffff]\n"
"# define MEM_ACCESS_REF(mem, addr) &mem->data[addr & WASM_HEAP_MASK]\n"
"#else\n"
"# define MEM_ACCESS_REF(mem, addr) &mem->data[addr]\n"
"#endif\n"

View File

@ -84,7 +84,7 @@
#if defined(WASM_USE_GUARD_PAGES) && UINTPTR_MAX == 0xffffffff
// on 32-bit platforms we have to mask memory access into range
# define MEM_ACCESS_REF(mem, addr) &mem->data[addr & 0x7fffff]
# define MEM_ACCESS_REF(mem, addr) &mem->data[addr & WASM_HEAP_MASK]
#else
# define MEM_ACCESS_REF(mem, addr) &mem->data[addr]
#endif

View File

@ -200,6 +200,10 @@ void wasm_rt_cleanup_func_types(wasm_func_type_t** p_func_type_structs, uint32_t
# define WASM_HEAP_RESERVE_SIZE 0x200000000ull
# define WASM_HEAP_MAX_ALLOWED_PAGES 65536
#elif UINTPTR_MAX == 0xffffffff
// Check that the mask used is consistent with the below values
# if WASM_HEAP_MASK != 0xffffff
# error "WASM_HEAP_MASK has an unexpected value compared to the expected value"
# endif
// Reserve 16MB, unaligned, max heap is 16MB
# define WASM_HEAP_GUARD_PAGE_ALIGNMENT 0
# define WASM_HEAP_RESERVE_SIZE 0x1000000ul

View File

@ -143,6 +143,12 @@ typedef struct {
#endif
} wasm_rt_memory_t;
// Wasm's 32-bit implementation uses masking.
#if UINTPTR_MAX == 0xffffffff
// Set the mask for 16MB
# define WASM_HEAP_MASK 0xffffff
#endif
/** A Table object. */
typedef struct {
/** The table element data, with an element count of `size`. */