diff --git a/kernel/orbis/src/vmem.cpp b/kernel/orbis/src/vmem.cpp index dadf38b77..b83c987dd 100644 --- a/kernel/orbis/src/vmem.cpp +++ b/kernel/orbis/src/vmem.cpp @@ -56,14 +56,24 @@ struct VirtualMemoryAllocation { isRelated(const VirtualMemoryAllocation &other, rx::AddressRange selfRange, [[maybe_unused]] rx::AddressRange rightRange) const { if (flags != other.flags || flagsEx != other.flagsEx || - prot != other.prot || type != other.type || device != other.device || - name != other.name) { + prot != other.prot || type != other.type || device != other.device) { return false; } + if (!isAllocated()) { return true; } + bool isAnon = std::string_view(name).starts_with("anon:"); + + if (isAnon) { + if (!std::string_view(other.name).starts_with("anon:")) { + return false; + } + } else if (name != other.name) { + return false; + } + if (device == nullptr || flags == orbis::vmem::BlockFlags::PooledMemory) { return true; } @@ -450,8 +460,6 @@ std::pair orbis::vmem::mapFile( return {{}, ErrorCode::INVAL}; } - allocFlags |= AllocationFlags::NoMerge; - if (prot) { blockFlags |= BlockFlags::Commited; }