aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2019-07-07 19:49:11 +0200
committerRon Evans <[email protected]>2019-07-08 00:09:59 +0200
commit00cc486619814a817c03145da481765fe909e818 (patch)
tree32f25581f197e728c86d73f7315c057e72c40945
parentd627208c48501e649a0c2a477f77556af1e35a99 (diff)
downloadtinygo-00cc486619814a817c03145da481765fe909e818.tar.gz
tinygo-00cc486619814a817c03145da481765fe909e818.zip
wasm: set the stack at the start of linear memory
This makes sure that a stack overflow will cause a "memory access out of bounds" error instead of a corruption of a global variable. Here is more background on a very similar stack overflow protection: https://blog.japaric.io/stack-overflow-protection/
-rw-r--r--targets/wasm.json1
1 files changed, 1 insertions, 0 deletions
diff --git a/targets/wasm.json b/targets/wasm.json
index 82fb6cedf..e8cdb5e15 100644
--- a/targets/wasm.json
+++ b/targets/wasm.json
@@ -14,6 +14,7 @@
"ldflags": [
"--allow-undefined",
"--no-threads",
+ "--stack-first",
"--export-all"
],
"emulator": ["node", "targets/wasm_exec.js"]