diff options
Diffstat (limited to 'executor/executor_bsd.h')
| -rw-r--r-- | executor/executor_bsd.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h index 5bb192d8c..3612e2569 100644 --- a/executor/executor_bsd.h +++ b/executor/executor_bsd.h @@ -17,7 +17,14 @@ static void os_init(int argc, char** argv, void* data, size_t data_size) { - if (mmap(data, data_size, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) != data) +#if GOOS_openbsd + // W^X not allowed by default on OpenBSD. + int prot = PROT_READ | PROT_WRITE; +#else + int prot = PROT_READ | PROT_WRITE | PROT_EXEC; +#endif + + if (mmap(data, data_size, prot, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) != data) fail("mmap of data segment failed"); // Some minimal sandboxing. |
