sbcl.sbcl/tools-for-build/mmap-rwx.c
Joshua Elsasser e0f4906962 Add a test for working mmap() of RWX pages on openbsd 6.0 and newer.
Unless a binary is linked with -zwxneeded and run from a filesystem
mounted with -o wxallowed then no page may have both the PROT_EXEC and
PROT_WRITE protections.
2018-11-08 11:05:27 -08:00

11 lines
197 B
C

#include <sys/mman.h>
int
main()
{
if (mmap(0, 1, PROT_EXEC|PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANON, -1, 0) == MAP_FAILED)
return 1;
return 0;
}