Skip to content

Commit

Permalink
executor: adapt os_init() to NetBSD with PaX MPROTECT
Browse files Browse the repository at this point in the history
Initialize syz data segment with protection allowed by PaX MPROTECT.

PROT_MPROTECT() registers future potential protection that is allowed
to be enabled in future.
  • Loading branch information
krytarowski authored and dvyukov committed Jan 9, 2019
1 parent 204b8f5 commit fe1c444
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions executor/executor_bsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe1c444

Please sign in to comment.