WebAssembly: limit slow memories
authorjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 19:38:52 +0000 (19:38 +0000)
committerjfbastien@apple.com <jfbastien@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 19 Apr 2017 19:38:52 +0000 (19:38 +0000)
commitd9b55e2187987b28438b2e96d3e1c7ffa838a229
tree558704587a3f9637bc5aa2418384b25557a93e05
parentc9104a30eb27da91b64a793be842c5320460bc9b
WebAssembly: limit slow memories
https://bugs.webkit.org/show_bug.cgi?id=170825

Reviewed by Saam Barati.

JSTests:

* wasm.yaml:
* wasm/stress/oom.js: Added.
(try.true.WebAssemblyMemoryMode):
(catch):

Source/JavaScriptCore:

We limits the number of fast memories, partly because ASLR. The
code then falls back to slow memories. It first tries to virtually
allocated any declared maximum (and in there, physically the
initial), and if that fails it tries to physically allocate the
initial without any extra.

This can still be used to cause a bunch of virtual
allocation. This patch imposes soft limit on slow memories as
well. The total virtual maximum for slow memories is set at the
same (theoretical) value as that for fast memories.

Anything exceeding that limit causes allocation/grow to fail.

* wasm/WasmMemory.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215525 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/wasm.yaml
JSTests/wasm/stress/oom.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wasm/WasmMemory.cpp