diff options
author | Sammy Kaye Powers <sammyk@php.net> | 2020-09-09 12:36:51 -0700 |
---|---|---|
committer | Sammy Kaye Powers <sammyk@php.net> | 2020-09-09 12:36:51 -0700 |
commit | 1b5268265c13b35cba290a5578ff973f797a0620 (patch) | |
tree | 0f480e0204dbc854650f63f27928b2f084f683d4 | |
parent | e6b2a97cac14e48acd4b5b9cf2b0f60244107f92 (diff) | |
parent | 2d4aa1ef3d04ec85a15ae426ffdaa4f2fb0f1556 (diff) | |
download | php-git-1b5268265c13b35cba290a5578ff973f797a0620.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fix #79825: opcache.file_cache causes SIGSEGV with custom opcode handlers
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 16 |
2 files changed, 18 insertions, 0 deletions
@@ -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); } |