From 19cfcead69273559ae293a84ce108d00416a3e55 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Fri, 31 Aug 2018 21:36:05 +0200 Subject: 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"). --- executor/executor_bsd.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'executor/executor_bsd.h') 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. -- cgit mrf-deployment