mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 11:31:51 +01:00
Mark CodeStatic regions that are writable as CodeMutable instead
This is required for applications that attempt to map from the bss.
This commit is contained in:
parent
2f8a217204
commit
1383e17341
@ -126,6 +126,11 @@ namespace skyline::kernel::type {
|
||||
throw exception("An error occurred while updating private memory's permissions in child process");
|
||||
|
||||
auto chunk = state.os->memory.GetChunk(address);
|
||||
|
||||
// If a static code region has been mapped as writable it needs to be changed to mutable
|
||||
if (chunk->state.value == memory::states::CodeStatic.value && permission.w)
|
||||
chunk->state = memory::states::CodeMutable;
|
||||
|
||||
BlockDescriptor block{
|
||||
.address = address,
|
||||
.size = size,
|
||||
|
@ -33,10 +33,10 @@ namespace skyline::loader {
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + executable.ro.offset, roSize, memory::Permission{true, false, false}, memory::states::CodeReadOnly); // R--
|
||||
state.logger->Debug("Successfully mapped section .rodata @ 0x{0:X}, Size = 0x{1:X}", base + executable.ro.offset, roSize);
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + executable.data.offset, dataSize, memory::Permission{true, true, false}, memory::states::CodeStatic); // RW-
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + executable.data.offset, dataSize, memory::Permission{true, true, false}, memory::states::CodeMutable); // RW-
|
||||
state.logger->Debug("Successfully mapped section .data @ 0x{0:X}, Size = 0x{1:X}", base + executable.data.offset, dataSize);
|
||||
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patchOffset, patchSize + padding, memory::Permission{true, true, true}, memory::states::CodeStatic); // RWX
|
||||
process->NewHandle<kernel::type::KPrivateMemory>(base + patchOffset, patchSize + padding, memory::Permission{true, true, true}, memory::states::CodeMutable); // RWX
|
||||
state.logger->Debug("Successfully mapped section .patch @ 0x{0:X}, Size = 0x{1:X}", base + patchOffset, patchSize + padding);
|
||||
|
||||
process->WriteMemory(executable.text.contents.data(), base + executable.text.offset, textSize);
|
||||
|
Loading…
Reference in New Issue
Block a user