fix(relinker): skip the flagless dynlib data segment in linux guest modules

GuestModuleWriter::WriteLinux adds read permission to every PT_LOAD, including
the SCE dynlib data segment, which has no flags and is never mapped on the PS5.
When that segment starts inside the last page of the preceding RW segment, the
read-only mapping covers the tail of its bss and the module's initializer faults
on its first write there. The symbol and relocation tables it holds are already
copied into the appended segment, so it no longer needs to be mapped.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ButHENCbXXt8h4EZuWUabJ
This commit is contained in:
Dean Galvin 2026-09-28 13:32:36 +13:00
parent 7656458121
commit 346b7280e2
1 changed files with 2 additions and 1 deletions

View File

@ -12,8 +12,9 @@ std::vector<std::uint8_t> GuestModuleWriter::WriteLinux(const Relinker::GuestIma
for (auto header : image.Headers) {
if (header.Type != 1 && header.Type != 7 && header.Type != 0x6474e550 && header.Type != 0x6474e551) continue;
if (header.Type == 1) {
header.Flags |= 4;
end = std::max(end, header.MappedAddress + header.MemorySize);
if (header.Flags == 0) continue;
header.Flags |= 4;
}
headers.push_back(header);
}