Fix GH-11336: php still tries to unlock the shared memory ZendSem with opcache.file_cache_only=1 but it was never locked

I chose to check for the value of lock_file instead of checking the
file_cache_only, because it is probably a little bit faster and we're
going to access the lock_file variable anyway. It's also more generic.

Closes GH-11341.
This commit is contained in:
Niels Dossche 2023-05-29 16:39:58 +02:00 committed by nielsdos
parent bce536067c
commit 9c59d22a7b
3 changed files with 7 additions and 1 deletions

2
NEWS
View File

@ -15,6 +15,8 @@ PHP NEWS
- Opcache:
. Fix allocation loop in zend_shared_alloc_startup(). (nielsdos)
. Access violation on smm_shared_globals with ALLOC_FALLBACK. (KoudelkaB)
. Fixed bug GH-11336 (php still tries to unlock the shared memory ZendSem
with opcache.file_cache_only=1 but it was never locked). (nielsdos)
- SPL:
. Fixed bug GH-11338 (SplFileInfo empty getBasename with more than one

View File

@ -354,6 +354,10 @@ static inline void accel_unlock_all(void)
#ifdef ZEND_WIN32
accel_deactivate_sub();
#else
if (lock_file == -1) {
return;
}
struct flock mem_usage_unlock_all;
mem_usage_unlock_all.l_type = F_UNLCK;

View File

@ -52,7 +52,7 @@ zend_smm_shared_globals *smm_shared_globals;
#ifdef ZTS
static MUTEX_T zts_lock;
#endif
int lock_file;
int lock_file = -1;
static char lockfile_name[MAXPATHLEN];
#endif