summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--ext/opcache/ZendAccelerator.c16
2 files changed, 18 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 2a3c248d26..757d225a4a 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,8 @@ PHP NEWS
. Fixed bug #80002 (calc free space for new interned string is wrong).
(t-matsuno)
. Fixed bug #80046 (FREE for SWITCH_STRING optimized away). (Nikita)
+ . Fixed bug #79825 (opcache.file_cache causes SIGSEGV when custom opcode
+ handlers changed). (SammyK)
- PDO:
. Fixed bug #80027 (Terrible performance using $query->fetch on queries with
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 6564e4ecc3..25148b0d4a 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2655,6 +2655,9 @@ static void accel_gen_system_id(void)
{
PHP_MD5_CTX context;
unsigned char digest[16];
+ zend_module_entry *module;
+ zend_extension *extension;
+ zend_llist_position pos;
PHP_MD5Init(&context);
PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
@@ -2665,6 +2668,19 @@ static void accel_gen_system_id(void)
PHP_MD5Update(&context, __DATE__, sizeof(__DATE__)-1);
PHP_MD5Update(&context, __TIME__, sizeof(__TIME__)-1);
}
+ /* Modules may have changed after restart which can cause dangling pointers from
+ * custom opcode handlers in the second-level cache files
+ */
+ ZEND_HASH_FOREACH_PTR(&module_registry, module) {
+ PHP_MD5Update(&context, module->name, strlen(module->name));
+ PHP_MD5Update(&context, module->version, strlen(module->version));
+ } ZEND_HASH_FOREACH_END();
+ extension = (zend_extension *) zend_llist_get_first_ex(&zend_extensions, &pos);
+ while (extension) {
+ PHP_MD5Update(&context, extension->name, strlen(extension->name));
+ PHP_MD5Update(&context, extension->version, strlen(extension->version));
+ extension = (zend_extension *) zend_llist_get_next_ex(&zend_extensions, &pos);
+ }
PHP_MD5Final(digest, &context);
php_hash_bin2hex(accel_system_id, digest, sizeof digest);
}