Skip to content

Commit

Permalink
Memory: fix critical bug in shm::unmap_critical (Linux)
Browse files Browse the repository at this point in the history
It was leaving holes in reserved areas.
Windows is unaffected.
  • Loading branch information
Nekotekina committed Jan 14, 2021
1 parent 4bee8dc commit ea916fd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rpcs3/util/vm_native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,9 @@ namespace utils
{
const auto target = reinterpret_cast<u8*>(reinterpret_cast<u64>(ptr) & -0x10000);

#ifdef _WIN32
this->unmap(target);

#ifdef _WIN32
::MEMORY_BASIC_INFORMATION mem, mem2;
if (!::VirtualQuery(target - 1, &mem, sizeof(mem)) || !::VirtualQuery(target + m_size, &mem2, sizeof(mem2)))
{
Expand All @@ -422,6 +422,8 @@ namespace utils
{
return;
}
#else
::mmap(reinterpret_cast<void*>(target), m_size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE | c_map_noreserve, -1, 0);
#endif
}

Expand Down

0 comments on commit ea916fd

Please sign in to comment.