Commit eb32f52f77c for php
commit eb32f52f77c83495e4d9325fcac7d482be5fabc7
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Fri Sep 25 00:54:36 2026 -0400
Zend: clear the AVX bit in ECX when the OS has not enabled AVX state
zend_cpu_startup() masked ZEND_CPU_FEATURE_AVX out of EDX when XCR0 lacks
the SSE or AVX state bits, but AVX is CPUID.1:ECX bit 28 and EDX bit 28 is
HTT. zend_cpu_supports(ZEND_CPU_FEATURE_AVX) kept reporting AVX, so builds
without __builtin_cpu_supports(), such as MSVC, let the JIT emit VEX-encoded
instructions that fault on such hosts.
Closes GH-23966
diff --git a/NEWS b/NEWS
index c70eb74ee53..c747dbcdcf5 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ PHP NEWS
comparison. (Arnaud)
. Fixed OSS-Fuzz #536440507 (Immutable class incorrect assertion).
(ndossche)
+ . Fixed AVX being reported as supported when the OS has not enabled AVX
+ state. (Ilia Alshanetsky)
- DOM:
. Fixed use-after-free when re-constructing a DOMXPath whose php:function
diff --git a/Zend/zend_cpuinfo.c b/Zend/zend_cpuinfo.c
index 6264031ceba..45857a7d6d6 100644
--- a/Zend/zend_cpuinfo.c
+++ b/Zend/zend_cpuinfo.c
@@ -135,7 +135,7 @@ void zend_cpu_startup(void)
}
if (!is_avx_supported()) {
- cpuinfo.edx &= ~ZEND_CPU_FEATURE_AVX;
+ cpuinfo.ecx &= ~ZEND_CPU_FEATURE_AVX;
cpuinfo.ebx &= ~(ZEND_CPU_FEATURE_AVX2 & ~ZEND_CPU_EBX_MASK);
}
}