Fix PHP 8.5+ ZTS segfault on CentOS 7 by disabling IFUNC resolvers#20027
Fix PHP 8.5+ ZTS segfault on CentOS 7 by disabling IFUNC resolvers#20027realFlowControl wants to merge 1 commit intophp:PHP-8.5from
Conversation
CentOS 7's glibc lacks __builtin_cpu_init() support, causing IFUNC resolvers to crash during dynamic linking when detecting AVX2 support. Disable IFUNC and use runtime function pointer initialization instead.
|
Looking good, but I do not know if it is requested to be "consistent" with FreeBSD check style, e.g. |
|
CentOS 7 is 11 years old and EOL for >1 year There are so much things outdated there, a lot of PHP dependencies are no longer satisfied I don't see the benefit of maintaining for dead targets |
Me neither but it is an "easy" fix and there are still folks using Linux with outdated glibc versions so I though: why not. An alternative could be to document the workaround we are using currently and that is just adding $ ./configure ax_cv_have_func_attribute_ifunc=no --enable-zts --other-flagsIDK where to document this, most likely just having this comment posted here might already be enough for folks to find it 😉 |
|
I remember Girgias and I had been discussing to level up the minimum os versions for the next major release. It was centos 8, solaris 10 ... for the next 8.6 I believe. |
CentOS 7's glibc (
2.17)__builtin_cpu_init()causesIFUNCresolvers to crash during dynamic linking when detecting AVX2 support on a ZTS build on Amd64 hardware.This PR disables
IFUNCon Amd64 hardware when a glibc version <=2.17is detected.The stacktrace for the segfault looks like this when executing a freshly build
./sapi/cli/php:This is even before PHP's
main()function is called.Arm64 is not affected because
zend_cpu_supports_avx2(void)has an early return for Arm64:php-src/Zend/zend_cpuinfo.h
Lines 200 to 210 in 52e1c9f
Why NTS is not affected: I have no idea 🫤
Also: why this is not a problem on PHP 8.4 ZTS Amd64: no idea either