Skip to content

Commit 1e148b6

Browse files
committed
ext/opcache/zend_shared_alloc: add assertions on "locked" flag
Let the PHP process crash if a bug causes incorrect locking calls.
1 parent a5f467c commit 1e148b6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/opcache/zend_shared_alloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ void zend_shared_alloc_safe_unlock(void)
468468

469469
void zend_shared_alloc_lock(void)
470470
{
471+
ZEND_ASSERT(!ZCG(locked));
472+
471473
#ifdef USE_PTHREAD_MUTEX
472474

473475
#ifdef ZTS
@@ -512,6 +514,8 @@ void zend_shared_alloc_lock(void)
512514

513515
void zend_shared_alloc_unlock(void)
514516
{
517+
ZEND_ASSERT(ZCG(locked));
518+
515519
#if !defined(ZEND_WIN32) && !defined(USE_PTHREAD_MUTEX)
516520
struct flock mem_write_unlock;
517521

0 commit comments

Comments
 (0)