diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 6fcfdf23e28a..866a6ce6505c 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -249,7 +249,11 @@ shmat(p, uap) if (i >= shminfo.shmseg) return EMFILE; size = round_page(shmseg->shm_segsz); +#ifdef VM_PROT_READ_IS_EXEC + prot = VM_PROT_READ | VM_PROT_EXECUTE; +#else prot = VM_PROT_READ; +#endif if ((uap->shmflg & SHM_RDONLY) == 0) prot |= VM_PROT_WRITE; flags = MAP_ANON | MAP_SHARED;