[php-src] PR #20027: Fix PHP 8.5+ ZTS segfault on CentOS 7 by disabling IFUNC resolvers
| From: | realFlowControl | Date: | Wed, 01 Oct 2025 12:06:50 +0000 |
| Subject: | [php-src] PR #20027: Fix PHP 8.5+ ZTS segfault on CentOS 7 by disabling IFUNC resolvers | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-33436@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20027
Author: realFlowControl
CentOS 7's glibc lacks
__builtin_cpu_init() support, causing IFUNC
resolvers to crash during dynamic linking when detecting AVX2 support. This PR disables
IFUNC and uses runtime function pointer initialisation instead.
The stacktrace for the segfault looks like this:
```
#0 0x0000555555972b5a in resolve_wchar_utf16be ()
#1 0x00007ffff7de6e6f in _dl_relocate_object () from /lib64/ld-linux-x86-64.so.2
#2 0x00007ffff7ddf99a in dl_main () from /lib64/ld-linux-x86-64.so.2
#3 0x00007ffff7df300e in _dl_sysdep_start () from /lib64/ld-linux-x86-64.so.2
#4 0x00007ffff7ddcbd1 in _dl_start () from /lib64/ld-linux-x86-64.so.2
#5 0x00007ffff7ddc148 in _start () from /lib64/ld-linux-x86-64.so.2
#6 0x0000000000000003 in ?? ()
#7 0x00007fffffffe287 in ?? ()
#8 0x00007fffffffe29a in ?? ()
#9 0x00007fffffffe29d in ?? ()
#10 0x0000000000000000 in ?? ()
```
This affects only PHP 8.5 ZTS on amd64 hardware, arm64 and NTS is not affected. Arm64 is not
affected because zend_cpu_supports_avx2(void) has an early return for Arm64:
https://github.com/php/php-src/blob/52e1c9f1107e1be19483d9f404d6a69c46c395c7/Zend/zend_cpuinfo.h#L200-L210
Why NTS is not affected: I have no idea 🫤