mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-26 03:55:37 +00:00
Fix Mprotect on free memory
On real hardware, this just does nothing. If something did get protected, there's no way to query that information. Therefore, it seems pretty safe to just behave like munmap and return size here.
This commit is contained in:
parent
5f6bf3a445
commit
a6ec84b493
@ -563,8 +563,9 @@ s64 MemoryManager::ProtectBytes(VAddr addr, VirtualMemoryArea vma_base, size_t s
|
||||
vma_base.size - start_in_vma < size ? vma_base.size - start_in_vma : size;
|
||||
|
||||
if (vma_base.type == VMAType::Free) {
|
||||
LOG_ERROR(Kernel_Vmm, "Cannot change protection on free memory region");
|
||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||
// On PS4, protecting freed memory does nothing.
|
||||
LOG_WARNING(Kernel_Vmm, "Attempting to protect free memory");
|
||||
return adjusted_size;
|
||||
}
|
||||
|
||||
// Validate protection flags
|
||||
|
Loading…
Reference in New Issue
Block a user