[php-src] Issue #8159: Apache / PHP segfaults (PHP 8.0 and 8.1, but also 7.4)
| From: | unix-world | Date: | Tue, 08 Mar 2022 11:23:22 +0000 |
| Subject: | [php-src] Issue #8159: Apache / PHP segfaults (PHP 8.0 and 8.1, but also 7.4) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240260@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8159
Comment Author: unix-world
Differences between PHP 7.3.33 and 8.0.16 in ext/opcache/ZendAccelerator.c that may cause the
crashing issue:
in PHP 8.0.16 (crashing) there is:
```
zend_result accel_post_deactivate(void)
{
if (ZCG(cwd)) {
zend_string_release_ex(ZCG(cwd), 0);
ZCG(cwd) = NULL;
}
if (!ZCG(enabled) || !accel_startup_ok) {
return SUCCESS;
}
zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
accel_unlock_all();
ZCG(counted) = 0;
return SUCCESS;
}
```
in PHP 7.3.33 (not crashing)
```
int accel_post_deactivate(void)
{
if (!ZCG(enabled) || !accel_startup_ok) {
return SUCCESS;
}
zend_shared_alloc_safe_unlock(); /* be sure we didn't leave cache locked */
accel_unlock_all();
ZCG(counted) = 0;
return SUCCESS;
}
```
In my opinion (not sure yet) somewhere at these lines the crash is producing for PHP 8.0.16, perhaps
in some circumstances cwd is NULL somehow ...:
```
if (ZCG(cwd)) {
zend_string_release_ex(ZCG(cwd), 0);
ZCG(cwd) = NULL;
}
```