Skip to content

Commit

Permalink
[Kernel] MmSetAddressProtect: Disable changing protection in executab…
Browse files Browse the repository at this point in the history
…le range
  • Loading branch information
Gliniak committed Aug 18, 2024
1 parent 365a220 commit 0ad1e3d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "xenia/kernel/xboxkrnl/xboxkrnl_memory.h"
#include "xenia/kernel/xboxkrnl/xboxkrnl_private.h"
#include "xenia/xbox.h"

DEFINE_bool(
ignore_offset_for_ranged_allocations, false,
"Allows to ignore 4k offset for physical allocations with provided range. "
Expand Down Expand Up @@ -513,6 +514,14 @@ void MmSetAddressProtect_entry(lpvoid_t base_address, dword_t region_size,

uint32_t protect = FromXdkProtectFlags(protect_bits);
auto heap = kernel_memory()->LookupHeap(base_address);

// More research required: 544307D1 uses it with base_address in xex range,
// which causes write exception in long term. Probably console disables
// modification of xex range page protection for security reasons.
if (heap->heap_type() == HeapType::kGuestXex) {
return;
}

heap->Protect(base_address.guest_address(), region_size, protect);
}
DECLARE_XBOXKRNL_EXPORT1(MmSetAddressProtect, kMemory, kImplemented);
Expand Down

0 comments on commit 0ad1e3d

Please sign in to comment.