[Bug]: Static PHP 8.5 x86_64 (herd-lite) SIGILL / "Illegal instruction" (exit 132) on CPUs without ADX (e.g. Intel Haswell i7-4790) — GMP built with ADX enabled
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- php
- Ambito
- build-system
Direzione di ricerca
Inizia con la configurazione di build della distribuzione PHP statica e le impostazioni di compilazione di GMP 6.3.0, quindi esegui lo script repro_gmp.php fornito su una CPU della classe Haswell. Verifica se le istruzioni ADX sono abilitate senza gating a runtime e verifica che un binario ricompilato completi gmp_mul senza SIGILL su CPU prive di ADX.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Platform
macOS
Operating system version
Linux 6.14.8-2-pve (Proxmox), x86_64
System architecture
Intel (x86)
Herd Version
laravel 13
PHP Version
php 8.5.0 (cli), NTS, Nov 20 2025
Bug description
Summary
A prebuilt static PHP 8.5.0 binary from your distribution crashes with SIGILL / Illegal instruction (exit 132) on any CPU that lacks the ADX instruction set — for example an Intel Core i7-4790 (Haswell). The crash is inside GMP 6.3.0's big-number multiplication (mpn_mul_1), which was compiled with ADX (adcx/adox) and BMI2 (mulx) enabled and shipped without a runtime CPUID gate. Haswell has BMI2 but no ADX, so the ADX instruction stream faults.
This is a broad compatibility problem: it will crash on every pre-Broadwell Intel (Sandy Bridge → Haswell) and many older/lower-end AMD parts, on a completely ordinary gmp_mul() call.
Environment
- Host CPU: Intel Core i7-4790 @ 3.60GHz (Haswell)
- has:
bmi1 bmi2 avx2 sse4_2—adxABSENT
- has:
- OS: Linux 6.14.8-2-pve (Proxmox), x86_64
- Binary:
php8.5.0 (cli), NTS,x86_64-linux-musl-gcc, static, stripped- Built by Beyond Code for php.new, Nov 20 2025
- GMP 6.3.0 (static), OpenSSL 3.6.0 (static)
- Thread safety: disabled
Root cause (build-time)
Your static build compiled the bundled GMP with ADX enabled (the shipped object contains adcx/adox), but shipping it that way is only safe if a runtime CPUID check selects the ADX path; otherwise it faults on any non-ADX CPU. The GMP code path here has BMI2+ADX instructions reachable unconditionally on the affected CPUs.
Suggested fix
- Rebuild GMP for the static PHP distribution without ADX — most simply
--disable-assembly(GMP then uses its portable C path), or ensure the compile flags do not enable-madx/-marchfor the GMP low-level multiply objects. - Ideally ensure GMP's runtime CPU detection (its
.asmmulx/ADX variants gate on the CPUID ADX bit) is actually being used, rather than a fixed instruction stream. - Re-test on a Haswell-class CPU (i7-4xxx / Xeon E3 v3) after rebuilding.
Impact
Any deployment of this static PHP build on hardware older than ADX support (roughly pre-2015 Intel Broadwell and many older AMD CPUs) will crash during ordinary big-number arithmetic (gmp_mul, and any library built on it, e.g. phpseclib BigInteger). This makes the distributed binary unusable on a large class of still-common servers/VMs.
*Separate root-cause report filed with GMP upstream.
Steps to reproduce
Reproducer (self-contained, no external libs)
<?php
$a = gmp_init(str_repeat('12345678901234567890', 40), 10);
$b = gmp_init(str_repeat('98765432109876543210', 40), 10);
$r = gmp_mul($a, $b);
echo gmp_strval($r, 10), "\n";
Run:
/path/to/php repro_gmp.php
Observed:
Illegal instruction
(exit code 132)
The size is chosen to force the multi-limb ADX multiply path; smaller multiplications that stay in a single-limb path may not fault, which is why this can appear intermittent.
Relevant log output
Illegal instruction
(exit code 132)
- Lingua principale
- Nessun dato sulla lingua
- Stelle
- 124
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di beyondcode/herd-community
-
[Bug]: PHP 8.3 php.ini missing auto_prepend_file and herd-ext extension lines (dump() undefined)ApertamacOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
beyondcode/herd-community#1693 ·
-
macOS
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
beyondcode/herd-community#1602 ·
-
[Bug]: 1.30.2 creates PHP 8.2 config and ~/.zshrc lines on every start, although 8.2 isn't installedApertafixed-in-next-release macOS
Difficoltà 3/5 1-2 giorni Idoneità per principianti 56/100
beyondcode/herd-community#1763 · 2 commenti ·
-
fixed-in-next-release macOS
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
beyondcode/herd-community#1760 ·
-
macOS
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
beyondcode/herd-community#1755 ·
Tutte le issue di beyondcode/herd-community
Issue simili
-
Build failure: limoAperta0.kind: build failure
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Upgrade to Go 1.27.1Apertahelp wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
meshery-extensions/meshery-mcp-server#63 · 1 commento ·
-
Upgrade to Go 1.27.1Apertahelp wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
package-update
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
oSoWoSo/vOid_Community_repOsitory#436 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
devops good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno