forked from WebAssembly/wasi-libc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
-fstack-protector
support to wasi-libc (WebAssembly#351)
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 ```
- Loading branch information
1 parent
a829eba
commit 155cc03
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters