#98

Illegal instruction (SIGILL) on Intel Pentium Gold - binary requires AVX

OpenJosefJezekopened 8mo ago

Description

The d3k CLI crashes immediately with Illegal instruction (core dumped) on CPUs that lack AVX instruction set support. The pre-compiled @d3k/linux-x64 binary appears to be compiled with AVX/AVX2 instructions, which are not available on lower-end x86_64 processors.

Steps to Reproduce

  1. Install dev3000 on a machine with an Intel Pentium Gold (or similar CPU without AVX)
  2. Run d3k (or the binary directly)
  3. Observe: Illegal instruction (core dumped), exit code 132

Environment

  • OS: Ubuntu 24.04.4 LTS (Noble Numbat)
  • Kernel: 6.17.0-14-generic
  • CPU: Intel Pentium Gold G6400 @ 4.00GHz (x86_64, no AVX/AVX2)
  • Node.js: v22.14.0
  • dev3000 version: 0.0.170
  • @d3k/linux-x64 version: 0.0.170

Root Cause

The CPU flags on this machine include SSE4.1, SSE4.2, POPCNT, AES, but not AVX or AVX2. The Intel Pentium Gold G6400 (Comet Lake) does not support AVX.

The pre-compiled binary at @d3k/linux-x64/bin/dev3000 uses instructions beyond what this CPU supports, resulting in SIGILL.

Suggested Fix

Compile the Linux x64 binary targeting a baseline x86_64 instruction set (e.g., SSE4.2 or x86-64-v2) instead of requiring AVX/AVX2 (x86-64-v3). This would ensure compatibility with a wider range of x86_64 processors, including Intel Pentium, Celeron, and older Core series.

Alternatively, provide separate binaries for different x86-64 microarchitecture levels (v2, v3).

Activity

2
elsigh8mo ago

have you tried asking an agent to do this and then build a canary and test it? I don't have a device like this to test on so it would be pretty hard for me to validate

JiwaniZakir7mo ago

The SIGILL (exit code 132) here is a clear sign the binary was compiled with -march=native or an explicit AVX/AVX2 target (e.g., -march=haswell or -march=x86-64-v3), which generates instructions the Pentium Gold G6400 simply doesn't have — despite being a fully valid x86_64 chip. The root cause is almost in the build configuration for the @d3k/linux-x64 package, likely in whatever Makefile, CMakeLists, or Rust config.toml/.cargo/config controls the compiler flags for the Linux x64 release artifact. Switching the target to -march=x86-64-v2 (SSE4.2 baseline) would cover this CPU without sacrificing much, since the Pentium Gold does support SSE4.1/SSE4.2 per the reported CPU flags. If maintaining separate AVX-optimized builds is desirable, a CPU feature detection step at startup (or a wrapper script using /proc/cpuinfo) could dispatch to the appropriate binary.