Skip to content

Commit e1a25ff

Browse files
MaxKellermannGirgias
authored andcommittedJan 2, 2023
ext/opcache/zend_shared_alloc: add assertions on "locked" flag
Let the PHP process crash if a bug causes incorrect locking calls.
1 parent a3d2c33 commit e1a25ff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎ext/opcache/zend_shared_alloc.c

+4
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ void zend_shared_alloc_safe_unlock(void)
453453

454454
void zend_shared_alloc_lock(void)
455455
{
456+
ZEND_ASSERT(!ZCG(locked));
457+
456458
#ifndef ZEND_WIN32
457459
struct flock mem_write_lock;
458460

@@ -490,6 +492,8 @@ void zend_shared_alloc_lock(void)
490492

491493
void zend_shared_alloc_unlock(void)
492494
{
495+
ZEND_ASSERT(ZCG(locked));
496+
493497
#ifndef ZEND_WIN32
494498
struct flock mem_write_unlock;
495499

0 commit comments

Comments
 (0)
Please sign in to comment.