Skip to content

Commit 10d43c4

Browse files
MaxKellermannGirgias
authored andcommitted
ext/opcache/zend_shared_alloc: change "locked" check to assertion
Calling zend_shared_alloc() without holding the lock is always a bug, not a fatal runtime error.
1 parent e1a25ff commit 10d43c4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

ext/opcache/zend_shared_alloc.c

+2-5
Original file line numberDiff line numberDiff line change
@@ -336,18 +336,15 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
336336

337337
void *zend_shared_alloc(size_t size)
338338
{
339+
ZEND_ASSERT(ZCG(locked));
340+
339341
int i;
340342
unsigned int block_size = ZEND_ALIGNED_SIZE(size);
341343

342344
if (UNEXPECTED(block_size < size)) {
343345
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Possible integer overflow in shared memory allocation (%zu + %zu)", size, PLATFORM_ALIGNMENT);
344346
}
345347

346-
#if 1
347-
if (!ZCG(locked)) {
348-
zend_accel_error_noreturn(ACCEL_LOG_ERROR, "Shared memory lock not obtained");
349-
}
350-
#endif
351348
if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */
352349
SHARED_ALLOC_FAILED();
353350
return NULL;

0 commit comments

Comments
 (0)