From fe1c444d388089a487b4ce7d3ecd1e3f37b3d140 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Wed, 9 Jan 2019 06:02:05 +0100 Subject: 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. --- executor/executor_bsd.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'executor') 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 -- cgit mrf-deployment