[php-src] Issue #11564: crash due to invalid pointer in mysqli with tcmalloc
| From: | sephiroth-j | Date: | Fri, 30 Jun 2023 09:08:13 +0000 |
| Subject: | [php-src] Issue #11564: crash due to invalid pointer in mysqli with tcmalloc | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244840@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11564
Author: sephiroth-j
### Description
We tried to use tcmalloc (tcmalloc_minimal) from [gperftools
v2.10](https://github.com/gperftools/gperftools) together with PHP. Unfortunately PHP-FPM crashes
right at the beginning in mysqli.so.
We tried both variants: a) adding
LD_PRELOAD=/opt/lamprt/lib/libtcmalloc_minimal.so and
b) adding libtcmalloc_minimal at compile time with -ltcmalloc_minimal
without LD_PRELOAD. Both variants cause a crash. Below is the stack trace of variant
a).
```
Jun 30 09:59:58 demo systemd-coredump[112399]: Process 112397 (php-fpm) of user 0 dumped core.
Stack trace of thread 112397:
#0 0x00007f2a7b77e0c7 raise (libc.so.6)
#1 0x00007f2a7b77f49a abort (libc.so.6)
#2 0x00007f2a7b7bd324 __libc_message
(libc.so.6)
#3 0x00007f2a7b7c2796 malloc_printerr
(libc.so.6)
#4 0x00007f2a7b7c35db _int_free (libc.so.6)
#5 0x00007f2a7a81b8e0 zm_startup_mysqli
(mysqli.so)
#6 0x00000000007f2929 zend_startup_module_ex
(php-fpm)
#7 0x00000000007f29c4 zend_startup_module_zval
(php-fpm)
#8 0x00000000007fff9b zend_hash_apply (php-fpm)
#9 0x0000000000789010 php_module_startup
(php-fpm)
#10 0x000000000049babd main (php-fpm)
#11 0x00007f2a7b769ac5 __libc_start_main
(libc.so.6)
#12 0x000000000049d499 _start (php-fpm)
```
complete core dump from systemd: [core
dump.log](https://github.com/php/php-src/files/11914724/core.dump.log)
### PHP Version
PHP 8.2.7
### Operating System
_No response_