Skip to content

Commit b0bc057

Browse files
committed
Prevent potential deadlock if accelerated globals cannot be allocated
Not sure if this is possible to hit in practice, zend_accel_error_noreturn doesn't return so the unlock isn't called. Other callsites that use both zend_accel_error_noreturn and zend_shared_alloc_unlock first perform the unlocking. Closes phpGH-11718.
1 parent e0aadc1 commit b0bc057

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ PHP NEWS
4848
- Opcache:
4949
. Fixed bug GH-10914 (OPCache with Enum and Callback functions results in
5050
segmentation fault). (nielsdos)
51+
. Prevent potential deadlock if accelerated globals cannot be allocated.
52+
(nielsdos)
5153

5254
- PCNTL:
5355
. Fixed bug GH-11498 (SIGCHLD is not always returned from proc_open).

ext/opcache/ZendAccelerator.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2863,8 +2863,8 @@ static int zend_accel_init_shm(void)
28632863
accel_shared_globals = zend_shared_alloc(sizeof(zend_accel_shared_globals) + sizeof(uint32_t));
28642864
}
28652865
if (!accel_shared_globals) {
2866-
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
28672866
zend_shared_alloc_unlock();
2867+
zend_accel_error_noreturn(ACCEL_LOG_FATAL, "Insufficient shared memory!");
28682868
return FAILURE;
28692869
}
28702870
memset(accel_shared_globals, 0, sizeof(zend_accel_shared_globals));

0 commit comments

Comments
 (0)