linker: fix segment protection flags

This commit is contained in:
DH 2024-09-01 18:50:22 +03:00
parent 26ffd8cbb2
commit f17e80db41

View file

@ -865,7 +865,7 @@ Ref<orbis::Module> rx::linker::loadModule(std::span<std::byte> image,
phdr.p_flags |= vm::kMapProtCpuWrite; // TODO: reprotect on relocations
}
vm::protect(imageBase + segmentBegin, segmentSize, phdr.p_flags);
vm::protect(imageBase + segmentBegin, segmentSize, phdr.p_flags & (vm::kMapProtCpuAll | vm::kMapProtGpuAll));
if (phdr.p_type == kElfProgramTypeLoad) {
if (result->segmentCount >= std::size(result->segments)) {