This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Unmap memory in tests
ClosedPublic

Authored by cryptoad on Jun 11 2019, 9:32 AM.

Details

Summary

The more tests are added, the more we are limited by the size of the
address space on 32-bit. Implement unmapTestOnly all around (like it
is in sanitzer_common) to be able to free up some memory.
This is not intended to be a proper "destructor" for an allocator, but
allows us to not fail due to having no memory left.

Diff Detail

Repository
rL LLVM

Event Timeline

cryptoad created this revision.Jun 11 2019, 9:32 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 11 2019, 9:32 AM
Herald added subscribers: Restricted Project, jfb, delcypher. · View Herald Transcript
morehouse added inline comments.Jun 11 2019, 9:50 AM
lib/scudo/standalone/primary32.h
93 ↗(On Diff #204088)

This looks incorrect. Is I * RegionSize a valid address?

lib/scudo/standalone/tests/primary_test.cc
25 ↗(On Diff #204088)

Should this also delete P? Same for below.

cryptoad marked 2 inline comments as done.Jun 11 2019, 10:29 AM
cryptoad added inline comments.
lib/scudo/standalone/primary32.h
93 ↗(On Diff #204088)

It is indeed a valid address. For the 32-bit primary, the address space is split in potential regions of RegionSize bytes, that we index via a one or two level bytemap.

lib/scudo/standalone/tests/primary_test.cc
25 ↗(On Diff #204088)

Good point thanks, I somehow thought it would still end up deleting the original pointer with a custom deleter. I will correct those.

cryptoad updated this revision to Diff 204103.Jun 11 2019, 10:34 AM
cryptoad marked an inline comment as done.

Update the deleters to actually delete the pointer itself as well.

This revision is now accepted and ready to land.Jun 11 2019, 10:50 AM
This revision was automatically updated to reflect the committed changes.