[php-src] Issue #11386: sigsegv in _efree
| From: | celesteking | Date: | Tue, 06 Jun 2023 22:34:01 +0000 |
| Subject: | [php-src] Issue #11386: sigsegv in _efree | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244611@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11386
Author: celesteking
### Description
I understand that 8.0 active phase ended, but I'm also somewhat unsure whether this
doesn't fit into security category. Couldn't reproduce with 8.1 and 8.2, but anything
below triggers it, albeit with slight irregularity.
```js
$ docker run -it --rm --name php7 --cap-add=SYS_PTRACE --security-opt seccomp:unconfined
php:8.0-cli-alpine /bin/sh
/ # echo extension=asdfsdaf.so > .user.ini
/ # touch x.html
/ # ( set -e; while [ 1 ]; do sleep 1 ; DOCUMENT_ROOT=
pwd php-cgi x.html ; done; )
X-Powered-By: PHP/8.0.28
Content-type: text/html; charset=UTF-8
X-Powered-By: PHP/8.0.28
Content-type: text/html; charset=UTF-8
Segmentation fault (core dumped)
/ #
```
No idea what's happening:
```gdb
0x0000000000706d99 in _efree (ptr=0xcc41b0) at /usr/src/debug/php-7.2.34/Zend/zend_alloc.c:2447
2447 if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) {
(gdb) bt
#0 0x0000000000706d99 in _efree (ptr=0xcc41b0) at /usr/src/debug/php-7.2.34/Zend/zend_alloc.c:2447
#1 0x00000000007a1eaf in _str_dtor (zv=0x7ffff7eaae90) at
/usr/src/debug/php-7.2.34/Zend/zend_string.c:50
#2 0x00000000007711f9 in zend_hash_destroy (ht=0xc9a760 <interned_strings_permanent>) at
/usr/src/debug/php-7.2.34/Zend/zend_hash.c:1236
#3 0x00000000007a22f4 in zend_interned_strings_dtor () at
/usr/src/debug/php-7.2.34/Zend/zend_string.c:103
#4 0x000000000069c5a2 in php_module_shutdown () at /usr/src/debug/php-7.2.34/main/main.c:2483
#5 0x0000000000905bc4 in main (argc=2, argv=0x7fffffffe3f8) at
/usr/src/debug/php-7.2.34/sapi/cgi/cgi_main.c:2819
(gdb) f 1
(gdb) p *str
$41 = {gc = {refcount = 16704463, u = {v = {type = 0 '\000', flags = 0 '\000',
gc_info = 0}, type_info = 0}}, h = 9230944976557744134, len = 8, val = "s"}
```
Thanks.
### PHP Version
8.0.28
### Operating System
_No response_