Skip to content

Commit

Permalink
[scudo] Avoid accessing inaccessible pages in unmap() in secondary (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiaHungDuan committed Aug 7, 2024
1 parent 89c8d68 commit e9c9fde
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compiler-rt/lib/scudo/standalone/secondary.h
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,11 @@ void MapAllocator<Config>::deallocate(const Options &Options, void *Ptr)
Cache.store(Options, H->CommitBase, H->CommitSize,
reinterpret_cast<uptr>(H + 1), H->MemMap);
} else {
unmap(H->MemMap);
// Note that the `H->MemMap` is stored on the pages managed by itself. Take
// over the ownership before unmap() so that any operation along with
// unmap() won't touch inaccessible pages.
MemMapT MemMap = H->MemMap;
unmap(MemMap);
}
}

Expand Down

0 comments on commit e9c9fde

Please sign in to comment.