DLATypeSystem: fix use-after-poison false positive

This commit fixes a use-after-poison false-positive report from ASAN.

This was due to misuse of SpecificBumpPtrAllocator together with
__asan_poison_memory_region.
The region was poisoned but not deallocated, which caused a the false
positive when trying to destroy and deallocate it in the destructor of
LayoutTypeSystem.

This was fixed by switching to plain BumpPtrAllocator, and properly
calling the Deallocate method, which wraps its own battle-tested ASAN
logic.
This commit is contained in:
Pietro Fezzardi
2021-05-18 12:11:42 +02:00
parent af8a47fe93
commit 7d4a1ba467
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -641,7 +641,7 @@ void LayoutTypeSystem::mergeNodes(const LayoutTypeSystemNodePtrVec &ToMerge) {
// Remove From from Layouts
bool Erased = Layouts.erase(From);
revng_assert(Erased);
__asan_poison_memory_region(From, sizeof(LayoutTypeSystemNode));
NodeAllocator.Deallocate(From);
}
}
@@ -675,7 +675,7 @@ void LayoutTypeSystem::removeNode(LayoutTypeSystemNode *ToRemove) {
bool Erased = Layouts.erase(ToRemove);
revng_assert(Erased);
__asan_poison_memory_region(ToRemove, sizeof(LayoutTypeSystemNode));
NodeAllocator.Deallocate(ToRemove);
}
static void moveEdgesWithoutSumming(LayoutTypeSystemNode *OldSrc,