Enforce W^X in mprotect() as well

This commit is contained in:
Pierre Pronchery 2019-03-27 02:42:49 +01:00
parent a86a774ce8
commit c51c10b78f

View File

@ -48,6 +48,12 @@ int mprotect(void * addr, size_t length, int prot)
errno = EINVAL;
return -1;
}
/* enforce W^X */
if((prot & (PROT_WRITE | PROT_EXEC)) == (PROT_WRITE | PROT_EXEC))
{
errno = EPERM;
return MAP_FAILED;
}
/* FIXME really implement */
return 0;
}