aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorAnton Lindqvist <anton.lindqvist@gmail.com>2018-08-31 21:36:05 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-08-31 15:04:17 -0700
commit19cfcead69273559ae293a84ce108d00416a3e55 (patch)
tree47659e4888e5c7d87807de2ee1ca1ac65398e505 /executor
parent97bc7ad1b8f28799987362eeaa36586af1396327 (diff)
executor: OpenBSD does not allow write and exec mappings by default
Since the OpenBSD target does not make use of syz_execute_func yet, just drop PROT_EXEC for now. Supporting write and exec would require one to edit /etc/fstab during installation. Regression introduced in commit a4718693 ("sys/linux: add syz_execute_func").
Diffstat (limited to 'executor')
-rw-r--r--executor/executor_bsd.h9
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.