Commit 155cc03
Add
Inlcude `__stack_chk_fail.c` and initialize `__stack_chk_guard` in ctor.
```
$ cat main.c
char input[] = "0123456789012345";
int main(void) {
char buf[8];
for (char *sp = input, *dp = buf; *sp != '\0'; sp++, dp++) {
*dp = *sp;
}
return 0;
}
$ clang main.c -fstack-protector
$ wasmtime ./a.out
Error: failed to run main module `./a.out`
Caused by:
0: failed to invoke command default
1: wasm trap: wasm `unreachable` instruction executed
wasm backtrace:
0: 0x258 - <unknown>!__stack_chk_fail
1: 0x21e - <unknown>!__original_main
2: 0xca - <unknown>!_start
```-fstack-protector support to wasi-libc (WebAssembly#351)1 parent a829eba commit 155cc03
2 files changed
+28
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
4 | 9 | | |
5 | 10 | | |
6 | 11 | | |
| |||
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
12 | 27 | | |
| 28 | + | |
13 | 29 | | |
14 | 30 | | |
15 | 31 | | |
| |||
20 | 36 | | |
21 | 37 | | |
22 | 38 | | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments