diff options
Diffstat (limited to 'deps/v8/src/base/sanitizer')
-rw-r--r-- | deps/v8/src/base/sanitizer/lsan-page-allocator.cc | 18 | ||||
-rw-r--r-- | deps/v8/src/base/sanitizer/lsan-virtual-address-space.cc | 32 | ||||
-rw-r--r-- | deps/v8/src/base/sanitizer/lsan-virtual-address-space.h | 19 |
3 files changed, 49 insertions, 20 deletions
diff --git a/deps/v8/src/base/sanitizer/lsan-page-allocator.cc b/deps/v8/src/base/sanitizer/lsan-page-allocator.cc index bb52eb368f..c50bb4611b 100644 --- a/deps/v8/src/base/sanitizer/lsan-page-allocator.cc +++ b/deps/v8/src/base/sanitizer/lsan-page-allocator.cc @@ -50,25 +50,21 @@ bool LsanPageAllocator::CanAllocateSharedPages() { } bool LsanPageAllocator::FreePages(void* address, size_t size) { - bool result = page_allocator_->FreePages(address, size); + CHECK(page_allocator_->FreePages(address, size)); #if defined(LEAK_SANITIZER) - if (result) { - __lsan_unregister_root_region(address, size); - } + __lsan_unregister_root_region(address, size); #endif - return result; + return true; } bool LsanPageAllocator::ReleasePages(void* address, size_t size, size_t new_size) { - bool result = page_allocator_->ReleasePages(address, size, new_size); + CHECK(page_allocator_->ReleasePages(address, size, new_size)); #if defined(LEAK_SANITIZER) - if (result) { - __lsan_unregister_root_region(address, size); - __lsan_register_root_region(address, new_size); - } + __lsan_unregister_root_region(address, size); + __lsan_register_root_region(address, new_size); #endif - return result; + return true; } } // namespace base diff --git a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.cc b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.cc index 1877c44b7b..cd8d0decae 100644 --- a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.cc +++ b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.cc @@ -17,7 +17,8 @@ namespace base { LsanVirtualAddressSpace::LsanVirtualAddressSpace( std::unique_ptr<v8::VirtualAddressSpace> vas) : VirtualAddressSpace(vas->page_size(), vas->allocation_granularity(), - vas->base(), vas->size()), + vas->base(), vas->size(), + vas->max_page_permissions()), vas_(std::move(vas)) { DCHECK_NOT_NULL(vas_); } @@ -27,28 +28,45 @@ Address LsanVirtualAddressSpace::AllocatePages(Address hint, size_t size, PagePermissions permissions) { Address result = vas_->AllocatePages(hint, size, alignment, permissions); #if defined(LEAK_SANITIZER) - if (result != 0) { + if (result) { __lsan_register_root_region(reinterpret_cast<void*>(result), size); } #endif // defined(LEAK_SANITIZER) return result; } -bool LsanVirtualAddressSpace::FreePages(Address address, size_t size) { - bool result = vas_->FreePages(address, size); +void LsanVirtualAddressSpace::FreePages(Address address, size_t size) { + vas_->FreePages(address, size); +#if defined(LEAK_SANITIZER) + __lsan_unregister_root_region(reinterpret_cast<void*>(address), size); +#endif // defined(LEAK_SANITIZER) +} + +Address LsanVirtualAddressSpace::AllocateSharedPages( + Address hint, size_t size, PagePermissions permissions, + PlatformSharedMemoryHandle handle, uint64_t offset) { + Address result = + vas_->AllocateSharedPages(hint, size, permissions, handle, offset); #if defined(LEAK_SANITIZER) if (result) { - __lsan_unregister_root_region(reinterpret_cast<void*>(address), size); + __lsan_register_root_region(reinterpret_cast<void*>(result), size); } #endif // defined(LEAK_SANITIZER) return result; } +void LsanVirtualAddressSpace::FreeSharedPages(Address address, size_t size) { + vas_->FreeSharedPages(address, size); +#if defined(LEAK_SANITIZER) + __lsan_unregister_root_region(reinterpret_cast<void*>(address), size); +#endif // defined(LEAK_SANITIZER) +} + std::unique_ptr<VirtualAddressSpace> LsanVirtualAddressSpace::AllocateSubspace( Address hint, size_t size, size_t alignment, - PagePermissions max_permissions) { + PagePermissions max_page_permissions) { auto subspace = - vas_->AllocateSubspace(hint, size, alignment, max_permissions); + vas_->AllocateSubspace(hint, size, alignment, max_page_permissions); #if defined(LEAK_SANITIZER) if (subspace) { subspace = std::make_unique<LsanVirtualAddressSpace>(std::move(subspace)); diff --git a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h index cc16561710..00cd32a39f 100644 --- a/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h +++ b/deps/v8/src/base/sanitizer/lsan-virtual-address-space.h @@ -33,18 +33,33 @@ class V8_BASE_EXPORT LsanVirtualAddressSpace final Address AllocatePages(Address hint, size_t size, size_t alignment, PagePermissions permissions) override; - bool FreePages(Address address, size_t size) override; + void FreePages(Address address, size_t size) override; + + Address AllocateSharedPages(Address hint, size_t size, + PagePermissions permissions, + PlatformSharedMemoryHandle handle, + uint64_t offset) override; + + void FreeSharedPages(Address address, size_t size) override; bool SetPagePermissions(Address address, size_t size, PagePermissions permissions) override { return vas_->SetPagePermissions(address, size, permissions); } + bool AllocateGuardRegion(Address address, size_t size) override { + return vas_->AllocateGuardRegion(address, size); + } + + void FreeGuardRegion(Address address, size_t size) override { + vas_->FreeGuardRegion(address, size); + } + bool CanAllocateSubspaces() override { return vas_->CanAllocateSubspaces(); } std::unique_ptr<VirtualAddressSpace> AllocateSubspace( Address hint, size_t size, size_t alignment, - PagePermissions max_permissions) override; + PagePermissions max_page_permissions) override; bool DiscardSystemPages(Address address, size_t size) override { return vas_->DiscardSystemPages(address, size); |