[php-src] PHP-8.4: Zend: clear the AVX bit in ECX when the OS has not enabled AVX state
| From: | Ilia Alshanetsky | Date: | Mon, 28 Sep 2026 20:45:20 +0000 |
| Subject: | [php-src] PHP-8.4: Zend: clear the AVX bit in ECX when the OS has not enabled AVX state | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-141641@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-09-28T16:04:17-04:00
Commit: https://github.com/php/php-src/commit/eb32f52f77c83495e4d9325fcac7d482be5fabc7
Raw diff: https://github.com/php/php-src/commit/eb32f52f77c83495e4d9325fcac7d482be5fabc7.diff
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
Changed paths:
M NEWS
M Zend/zend_cpuinfo.c
Diff:
diff --git a/NEWS b/NEWS
index c70eb74ee53b..c747dbcdcf57 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 6264031ceba4..45857a7d6d65 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);
}
}