Commit f2adce5b authored by Bartek Nowierski's avatar Bartek Nowierski Committed by Chromium LUCI CQ

PA: Call PartitionRefCountPointerNoDCheck on 2 more paths

If GigaCage isn't enabled, this DCHECK will get triggered:
{FreeNoHooksImmediate,PartitionAllocFreeForRefCounting}->
->PartitionRefCountPointer->DCheckGetSlotOffsetIsZero->
->PartitionAllocGetSlotOffset->
->DCheckIfManagedByPartitionAllocNormalBuckets

GigaCage isn't needed to set up PartitionRefCount. It's only needed to
easily detect from BackupRefPtr code if PartitionRefCount is available,
but this won't be an issue because BackupRefPtr is disabled when
GigaCage isn't needed.

Bug: 1073933
Change-Id: I78faea9427ca06643033d0025cdef6472131c816
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2621855
Auto-Submit: Bartek Nowierski <bartekn@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Reviewed-by: default avatarKeishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842861}
parent 8692c7cc
...@@ -693,7 +693,7 @@ ALWAYS_INLINE void* PartitionAllocGetSlotStart(void* ptr) { ...@@ -693,7 +693,7 @@ ALWAYS_INLINE void* PartitionAllocGetSlotStart(void* ptr) {
// TODO(glazunov): Simplify the function once the non-thread-safe PartitionRoot // TODO(glazunov): Simplify the function once the non-thread-safe PartitionRoot
// is no longer used. // is no longer used.
ALWAYS_INLINE void PartitionAllocFreeForRefCounting(void* slot_start) { ALWAYS_INLINE void PartitionAllocFreeForRefCounting(void* slot_start) {
PA_DCHECK(!internal::PartitionRefCountPointer(slot_start)->IsAlive()); PA_DCHECK(!internal::PartitionRefCountPointerNoDCheck(slot_start)->IsAlive());
auto* slot_span = auto* slot_span =
SlotSpanMetadata<ThreadSafe>::FromPointerNoAlignmentCheck(slot_start); SlotSpanMetadata<ThreadSafe>::FromPointerNoAlignmentCheck(slot_start);
...@@ -870,7 +870,7 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::FreeNoHooksImmediate( ...@@ -870,7 +870,7 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::FreeNoHooksImmediate(
#if ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR #if ENABLE_REF_COUNT_FOR_BACKUP_REF_PTR
if (allow_ref_count) { if (allow_ref_count) {
if (LIKELY(!slot_span->bucket->is_direct_mapped())) { if (LIKELY(!slot_span->bucket->is_direct_mapped())) {
auto* ref_count = internal::PartitionRefCountPointer(slot_start); auto* ref_count = internal::PartitionRefCountPointerNoDCheck(slot_start);
// If we are holding the last reference to the allocation, it can be freed // If we are holding the last reference to the allocation, it can be freed
// immediately. Otherwise, defer the operation and zap the memory to turn // immediately. Otherwise, defer the operation and zap the memory to turn
// potential use-after-free issues into unexploitable crashes. // potential use-after-free issues into unexploitable crashes.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment