mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-10 01:28:44 +02:00
test(guest_memory): pin mprotect on an unmapped and a wrapping range
Both return -1/EINVAL: FreeBSD kern_mprotect (sys/vm/vm_mmap.c) maps only PROTECTION_FAILURE, RESOURCE_SHORTAGE and OUT_OF_BOUNDS to their own errno, so KERN_INVALID_ADDRESS falls to EINVAL. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1123,6 +1123,11 @@ int main() {
|
||||
Require(memory[page * 2] == 73);
|
||||
Require(munmap_nid_postfix(memory + page * 2, page) == 0);
|
||||
Require(munmap_nid_postfix(memory, page) == -1);
|
||||
*__error_nid_postfix() = 0;
|
||||
Require(mprotect_nid_postfix(memory, page, 1) == -1 && *__error_nid_postfix() == 22);
|
||||
*__error_nid_postfix() = 0;
|
||||
Require(mprotect_nid_postfix(memory, std::numeric_limits<std::size_t>::max(), 1) == -1 &&
|
||||
*__error_nid_postfix() == 22);
|
||||
for (int protection : {0, 1, 3, 5}) {
|
||||
void* mapped = mmap_nid_postfix(memory, 1, protection, 0x1002, -1, 0);
|
||||
Require(mapped != failed);
|
||||
|
||||
Reference in New Issue
Block a user