1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

UserspaceEmulator: Forget ChunkedBlocks after they are munmap()'ed

This is not ideal since we lose free() backtraces, but it will require
some thinking to get this right.
This commit is contained in:
Andreas Kling 2020-11-14 23:07:07 +01:00
parent 2066f48b87
commit 8fd97bee7f
3 changed files with 16 additions and 0 deletions

View file

@ -40,6 +40,14 @@ MallocTracer::MallocTracer()
{
}
void MallocTracer::notify_malloc_block_was_released(Badge<MmapRegion>, MmapRegion& region)
{
// FIXME: It's sad that we may lose a bunch of free() backtraces here,
// but if the address is reused for a new ChunkedBlock, things will
// get extremely confused.
m_chunked_blocks.remove(region.base());
}
void MallocTracer::target_did_malloc(Badge<SoftCPU>, FlatPtr address, size_t size)
{
auto* region = Emulator::the().mmu().find_region({ 0x20, address });