This commit is contained in:
Tavi 2024-01-10 12:51:51 -07:00 committed by GitHub
commit 6d33d8b40d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,12 @@ bool memory_unmap(void *ptr, size_t size) {
static bool memory_protect_prot(void *ptr, size_t size, int prot, UNUSED int pkey) {
#ifdef USE_PKEY
bool ret = pkey_mprotect(ptr, size, prot, pkey);
bool ret;
if (pkey > 0) {
ret = pkey_mprotect(ptr, size, prot, pkey);
} else {
ret = mprotect(ptr, size, prot);
}
#else
bool ret = mprotect(ptr, size, prot);
#endif