*Scan: Fix test failures caused by double free in write_protector
6b5ab9570d
introduced write_protector unique_ptr into PCScanInternal.
In tests there was a scenario:
1) upon PCScan test destruction PartitionAllocGlobalUninitForTesting()
is called;
2) the new PCScan test calls PCScanInternal::Initialize(), which resets
write_protector, trying to delete existing pointer, which was already
deleted by PartitionAllocGlobalUninitForTesting().
The CL resets this unique_ptr explicitly in
PCScanInternal::ClearRootsForTesting().
Bug: 1206047
Change-Id: I795b0ff84ecfb90a10735c60432caf02c9f7d54e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2913257
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#885822}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
fda55c9d83
commit
34a5eac73a
@ -1198,6 +1198,9 @@ void PCScanInternal::ClearRootsForTesting() {
|
||||
}
|
||||
scannable_roots_.ClearForTesting(); // IN-TEST
|
||||
nonscannable_roots_.ClearForTesting(); // IN-TEST
|
||||
// Destroy write protector object, so that there is no double free on the next
|
||||
// call to ReinitForTesting();
|
||||
write_protector_.reset();
|
||||
}
|
||||
|
||||
void PCScanInternal::ReinitForTesting(PCScan::WantedWriteProtectionMode mode) {
|
||||
|
Reference in New Issue
Block a user