Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 09c32c0766bbe1a7a396d7c9871415170c139a63
      
https://github.com/WebKit/WebKit/commit/09c32c0766bbe1a7a396d7c9871415170c139a63
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-05-07 (Thu, 07 May 2026)

  Changed paths:
    M Source/bmalloc/libpas/src/libpas/pas_scavenger.c
    M Source/bmalloc/libpas/src/test/ScavengerExternalWorkTests.cpp
    M Source/bmalloc/libpas/src/test/TestHarness.cpp

  Log Message:
  -----------
  [libpas] `pas_scavenger_try_install_foreign_work_callback` leaks 
`foreign_work.lock` when descriptor table is full
https://bugs.webkit.org/show_bug.cgi?id=314286

Reviewed by Yusuke Suzuki.

pas_scavenger_try_install_foreign_work_callback acquires
foreign_work.lock at entry but, when slot >=
PAS_SCAVENGER_MAX_FOREIGN_WORK_DESCRIPTORS, returned false without
unlocking. Every saturated call permanently wedges the mutex, so the
next install attempt (and the scavenger thread, when it next touches
foreign_work) blocks forever.

Add the missing pthread_mutex_unlock on the saturated path.

While here, register the existing ScavengerExternalWork suite from
main(); it had a forward declaration but no ADD_SUITE call, so the
suite never ran and the existing testCallbacksAreCalledWhenExpected was
dead code.

Add a regression test that saturates the descriptor table and uses
pthread_mutex_trylock on pas_scavenger_data_instance->foreign_work.lock
to assert the lock was released. Without the fix the trylock returns
EBUSY (16) and the test fails; with the fix it returns 0.

* Source/bmalloc/libpas/src/libpas/pas_scavenger.c:
(pas_scavenger_try_install_foreign_work_callback):
* Source/bmalloc/libpas/src/test/ScavengerExternalWorkTests.cpp:
(noopForeignWorkCallback):
(testForeignWorkCallbackInstallReleasesLockOnSaturation):
(addScavengerExternalWorkTests):
* Source/bmalloc/libpas/src/test/TestHarness.cpp:
(main):

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



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

Reply via email to