aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamil Rytarowski <krytarowski@users.noreply.github.com>2019-01-09 06:02:05 +0100
committerDmitry Vyukov <dvyukov@google.com>2019-01-09 06:02:05 +0100
commitfe1c444d388089a487b4ce7d3ecd1e3f37b3d140 (patch)
tree79698a27147d28a26d0c20b953fcd56892490c79
parent204b8f590633249fbd0ce26c25e99b2e9e0b305f (diff)
executor: adapt os_init() to NetBSD with PaX MPROTECT
Initialize syz data segment with protection allowed by PaX MPROTECT. PROT_MPROTECT() registers future potential protection that is allowed to be enabled in future.
-rw-r--r--executor/executor_bsd.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/executor/executor_bsd.h b/executor/executor_bsd.h
index 1095c2beb..298f22d95 100644
--- a/executor/executor_bsd.h
+++ b/executor/executor_bsd.h
@@ -15,6 +15,9 @@ static void os_init(int argc, char** argv, void* data, size_t data_size)
#if GOOS_openbsd
// W^X not allowed by default on OpenBSD.
int prot = PROT_READ | PROT_WRITE;
+#elif GOOS_netbsd
+ // W^X not allowed by default on NetBSD (PaX MPROTECT).
+ int prot = PROT_READ | PROT_WRITE | PROT_MPROTECT(PROT_EXEC);
#else
int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
#endif