OpenBSD: constrain W^X-by-signal to x86_64

Closes #2214
This commit is contained in:
Matthew Flatt 2018-08-11 16:40:09 -06:00
parent 89583a4d03
commit 305d02f46a
2 changed files with 6 additions and 1 deletions

View File

@ -212,6 +212,7 @@
# if defined(__x86_64__)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "x86_64-openbsd"
# define IMPLEMENT_WRITE_XOR_EXECUTE_BY_SIGNAL_HANDLER
# elif defined(__i386__) || defined(i386)
# define SCHEME_PLATFORM_LIBRARY_SUBPATH "i386-openbsd"
# elif defined(__mips64__)
@ -249,7 +250,6 @@
# define USE_IEEE_FP_PREDS
# define USE_MAP_ANON
# define IMPLEMENT_WRITE_XOR_EXECUTE_BY_SIGNAL_HANDLER
# if defined(__x86_64__)
# define MZ_USE_JIT_X86_64

View File

@ -110,6 +110,11 @@ static void init_allocation_callback(void);
#endif
#ifdef IMPLEMENT_WRITE_XOR_EXECUTE_BY_SIGNAL_HANDLER
/* For this option to work, the `si->si_addr` value provided
to the signal handler on a no-execute-permission signal
must be the address that isn't executable, as opposed to
the address of an instruction that tried to call or jump to
a non-executable address. */
static void install_w_xor_x_handler();
static void register_as_executable(void *p, size_t len, int can_exec);
#endif