This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Fix a bug in the new Secondary Allocator
ClosedPublic

Authored by cryptoad on Sep 20 2016, 3:02 PM.

Details

Summary

GetActuallyAllocatedSize() was not accounting for the last page of the mapping
being a guard page, and was returning the wrong number of actually allocated
bytes, which in turn would mess up with the realloc logic. Current tests didn't
find this as the size exercised was only serviced by the Primary.

Correct the issue by subtracting PageSize, and update the realloc test to
exercise paths in both the Primary and the Secondary.

Diff Detail

Event Timeline

cryptoad updated this revision to Diff 71991.Sep 20 2016, 3:02 PM
cryptoad retitled this revision from to [scudo] Fix a bug in the new Secondary Allocator GetActuallyAllocatedSize() was not accounting for the last page of the mapping being a guard page, and was returning the wrong number of actually allocated bytes, which in turn would mess up with....
cryptoad updated this object.
cryptoad retitled this revision from [scudo] Fix a bug in the new Secondary Allocator GetActuallyAllocatedSize() was not accounting for the last page of the mapping being a guard page, and was returning the wrong number of actually allocated bytes, which in turn would mess up with... to [scudo] Fix a bug in the new Secondary Allocator .Sep 20 2016, 3:02 PM
cryptoad updated this object.
cryptoad added a reviewer: kcc.
cryptoad added a subscriber: llvm-commits.
kcc accepted this revision.Sep 20 2016, 3:24 PM
kcc edited edge metadata.

LGTM

This revision is now accepted and ready to land.Sep 20 2016, 3:24 PM
cryptoad closed this revision.Sep 20 2016, 3:26 PM