[webkit-changes] [WebKit/WebKit] e2a9ba: ThreadSafeWeakPtrControlBlock should retain itself...

Keith Miller noreply at github.com
Thu Dec 5 18:51:29 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e2a9ba4461a4f1759a8f9afb0a1b7cdda6fc81b8
      https://github.com/WebKit/WebKit/commit/e2a9ba4461a4f1759a8f9afb0a1b7cdda6fc81b8
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2024-12-05 (Thu, 05 Dec 2024)

  Changed paths:
    M Source/WTF/wtf/ThreadSafeWeakPtr.h

  Log Message:
  -----------
  ThreadSafeWeakPtrControlBlock should retain itself during the object's destruction
https://bugs.webkit.org/show_bug.cgi?id=284119
rdar://140988960

Reviewed by Mark Lam and Alex Christensen.

We need to take a weak ref to ControlBlocks so they survive until after the
delete of m_object finishes. This comes up when destructors try to eagerly
remove themselves from WeakHashSets. e.g.

```
~MyObject() { m_weakSet.remove(this); }
```

If m_weakSet has the last reference to the ControlBlock then we could end up doing
an amortized clean up, which removes the ControlBlock and destroys it. Then when we
check m_weakSet's backing table after the cleanup we UAF the ControlBlock.

* Source/WTF/wtf/ThreadSafeWeakPtr.h:
(WTF::ThreadSafeWeakPtrControlBlock::strongDeref const):

Canonical link: https://commits.webkit.org/287425@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list