Skip to content

Commit

Permalink
Undefine FORTIFY_SOURCE for longjmp
Browse files Browse the repository at this point in the history
See the comment in the source file, we can't have FORTIFY_SOURCE enabled for longjmp code, so undefine it.

See the source for longjmp_chk in glibc, this assertion is fired: https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/____longjmp_chk.c;hb=HEAD#l54

Here is a similar commit in glibc tests: https://sourceware.org/git/?p=glibc.git;a=commit;h=46432be2f1d4de962b51ca6b9f80fc37744be9f7
  • Loading branch information
rockwotj authored Sep 11, 2024
1 parent d29b280 commit bd52389
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/wasmtime/src/runtime/vm/helpers.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// When using _FORTIFY_SOURCE with `longjmp` causes longjmp_chk to be used instead.
// longjmp_chk ensures that the jump target is on the existing stack.
// For our use case of jumping between stacks we need to disable it.
#undef _FORTIFY_SOURCE

#include <setjmp.h>
#include <stdint.h>
#include <stdlib.h>
Expand Down

0 comments on commit bd52389

Please sign in to comment.