mirror of
git://git.code.sf.net/p/sbcl/sbcl
synced 2026-09-10 07:26:40 -04:00
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.
This commit is contained in:
parent
77fb7b7f97
commit
e0f4906962
|
|
@ -443,6 +443,21 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$sbcl_os" in
|
||||||
|
openbsd)
|
||||||
|
# openbsd 6.0 and newer restrict mmap of RWX pages
|
||||||
|
if [ $(uname -r | tr -d .) -gt 60 ]; then
|
||||||
|
rm -f tools-for-build/mmap-rwx
|
||||||
|
LDFLAGS="$LDFLAGS -Wl,-zwxneeded" $GNUMAKE -C tools-for-build mmap-rwx -I ../src/runtime
|
||||||
|
if ! ./tools-for-build/mmap-rwx; then
|
||||||
|
echo "Can't mmap() RWX pages!"
|
||||||
|
echo "Is the current filesystem mounted with wxallowed?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
bf=`pwd`/build-features.lisp-expr
|
bf=`pwd`/build-features.lisp-expr
|
||||||
echo //initializing $bf
|
echo //initializing $bf
|
||||||
echo ';;;; This is a machine-generated file.' > $bf
|
echo ';;;; This is a machine-generated file.' > $bf
|
||||||
|
|
|
||||||
10
tools-for-build/mmap-rwx.c
Normal file
10
tools-for-build/mmap-rwx.c
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
#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;
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue