build: v6.2.0 — disable AVX-512 autovec, fix v6.1.9 SIGILL

v6.1.9 was built on a GitHub Actions EPYC 7763 runner (AVX-512 capable)
and contained 741 vpbroadcastq EVEX instructions in inlined libstdc++
std::string paths. The resulting binary crashed with SIGILL on every
production node: KVM EPYC (DNS2), Ryzen 5 3600 (SAMI-PC), and any
non-x86_64 node.

cmake/AddCompilerFlags.cmake already set -march=x86-64-v2 -mtune=generic
but GCC 11.4 + libstdc++ inlining still autovectorized some paths to
AVX-512. The fix adds an explicit -mno-avx512f -mno-avx512* block
inside CMAKE_X86_64_BASELINE so the build cannot leak AVX-512 regardless
of the build host's capabilities.

Carries forward the v6.1.9 staking-selfheal fix (f69f087) unchanged.
Bump version 6.1.9 -> 6.2.0 to reflect the build-system change.

See references/avx-512-sigill-build-fix.md for the full diagnosis
recipe and the verification steps.
This commit is contained in:
Sami Ahmed
2026-08-01 13:35:54 -07:00
parent 668c64276f
commit 8a48b308a8
14 changed files with 242 additions and 23 deletions
+19
View File
@@ -5,6 +5,25 @@ All notable changes to Triangles (TRI) are documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [6.2.0] - 2026-08-01
### Fixed
- **Build portability: v6.1.9 binary crashed with SIGILL on every
production node.** v6.1.9 was built on GitHub Actions' EPYC 7763
runner (AVX-512 capable). GCC 11.4 + libstdc++ inlining emitted 741
`vpbroadcastq` EVEX instructions into the daemon binary even though
the cmake `AddCompilerFlags.cmake` was setting `-march=x86-64-v2
-mtune=generic`. The resulting binary crashed on every production
CPU that lacks AVX-512: KVM-virtualized EPYC (DNS2), Ryzen 5 3600
(SAMI-PC), and any non-x86_64 node. v6.2.0 adds an explicit
`-mno-avx512f -mno-avx512*` block to the global compile options so
the build cannot leak AVX-512 regardless of what the build host
supports. Carries forward the v6.1.9 staking-selfheal fix unchanged.
See `references/avx-512-sigill-build-fix.md` for the full diagnosis.
### Changed
- Bump version 6.1.9 → 6.2.0 to reflect the build-system change.
## [6.1.9] - 2026-07-31
### Fixed
+20
View File
@@ -77,6 +77,26 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$" AND NOT WIN32 AND NOT
# build host. Combined with -march=x86-64-v2 above, the scheduler
# picks instructions from the v2 subset only — no AVX-512 leaks.
add_compile_options(-mtune=generic)
# Belt-and-suspenders: explicitly disable AVX-512 / AVX10 / SVE
# family ISAs that GCC 11+ can otherwise autovectorize into via
# inlined libstdc++ std::string / std::copy / memcpy paths even when
# -march=x86-64-v2 is set. Discovered 2026-08-01: v6.1.9 binary built
# on EPYC 7763 (AVX-512) contained 741 vpbroadcastq EVEX instructions
# which crash with SIGILL on every production node (KVM EPYC,
# Ryzen 3600, ARM64) that lacks AVX-512. -mno-avx512f alone is
# enough to suppress the SIGILL; the -mno-*avx10/sve* siblings
# future-proof against the next GCC version autovectorizing
# beyond AVX-512. See references/avx-512-sigill-build-fix.md
# for the full diagnosis recipe.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(
-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd
-mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma
-mno-avx512vbmi -mno-avx512vbmi2 -mno-avx512vnni
-mno-avx512bitalg -mno-avx512vpopcntdq -mno-avx512-4fmaps
-mno-avx512-4vnniw -mno-avx512vp2intersect
)
endif()
endif()
endif()
+1 -1
View File
@@ -3,7 +3,7 @@
# Run on a Linux x64 system with appimagetool installed
set -e
VERSION="6.1.7"
VERSION="6.2.0"
APPDIR="Triangles-x86_64.AppDir"
RELEASE_URL="https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${VERSION}"
+1 -1
View File
@@ -3,7 +3,7 @@
# Run from the packaging/debian directory
set -e
VERSION="6.1.7"
VERSION="6.2.0"
PKGDIR="triangles_${VERSION}-1_amd64"
RELEASE_URL="https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${VERSION}"
+3 -3
View File
@@ -1,6 +1,6 @@
FROM ubuntu:22.04 AS builder
ARG VERSION=6.1.7
ARG VERSION=6.2.0
ARG DEB_URL=https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${VERSION}/cryptographic-triangles-daemon_${VERSION}_amd64.deb
RUN apt-get update && apt-get install -y --no-install-recommends \
@@ -13,11 +13,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# ---------- Runtime ----------
FROM ubuntu:22.04
ARG VERSION=6.1.7
ARG VERSION=6.2.0
LABEL maintainer="Cryptographic Triangles Team"
LABEL description="Cryptographic Triangles (TRI) headless daemon"
LABEL version="6.1.7"
LABEL version="6.2.0"
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
+1 -1
View File
@@ -3,7 +3,7 @@ version: "3.8"
services:
trianglesd:
build: .
image: cryptographic-triangles/trianglesd:6.1.7
image: cryptographic-triangles/trianglesd:6.2.0
container_name: trianglesd
restart: unless-stopped
ports:
@@ -25,7 +25,7 @@ modules:
- install -Dm644 org.cryptographic_triangles.TrianglesQt.metainfo.xml /app/share/metainfo/org.cryptographic_triangles.TrianglesQt.metainfo.xml
sources:
- type: file
url: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-v6.1.7-linux-x64-qt
url: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-v6.2.0-linux-x64-qt
sha256: ed220eb8d0b403f62cdac28988541fd1a27864491e233216f9c00a4c2537b4a3
dest-filename: triangles-qt-linux
- type: file
@@ -55,6 +55,6 @@ modules:
- install -Dm755 trianglesd-linux /app/bin/trianglesd
sources:
- type: file
url: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-v6.1.7-linux-x64-daemon
url: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-v6.2.0-linux-x64-daemon
sha256: 4d2ab25d61127d6aff3e6f3069556d04f4b823f8849e97629c12871ad4779517
dest-filename: trianglesd-linux
+1 -1
View File
@@ -4,7 +4,7 @@
# Install build tools: sudo dnf install rpm-build rpmdevtools
set -e
VERSION="6.1.7"
VERSION="6.2.0"
RELEASE_URL="https://github.com/SamiAhmed7777/triangles_v5/releases/download/v${VERSION}"
echo "Building RPM for Triangles v${VERSION}..."
+1 -1
View File
@@ -1,5 +1,5 @@
Name: triangles
Version: 6.1.7
Version: 6.2.0
Release: 1%{?dist}
Summary: Cryptographic Triangles (TRI) cryptocurrency wallet
License: MIT
+2 -2
View File
@@ -1,11 +1,11 @@
{
"version": "6.1.7",
"version": "6.2.0",
"description": "Cryptographic Triangles (TRI) cryptocurrency wallet with PoS staking and encrypted messaging",
"homepage": "https://cryptographic-triangles.org",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-6.1.7-win-x64.zip",
"url": "https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-6.2.0-win-x64.zip",
"hash": "6f002a669a7e92aaf3d8dd7b1ae80f06a086c99a15ca05cf107665009ffc06b7"
}
},
@@ -1,5 +1,5 @@
PackageIdentifier: CryptographicTriangles.TrianglesQt
PackageVersion: 6.1.7
PackageVersion: 6.2.0
PackageLocale: en-US
Publisher: Cryptographic Triangles
PublisherUrl: https://cryptographic-triangles.org
@@ -27,7 +27,7 @@ Installers:
- RelativeFilePath: triangles-qt.exe
PortableCommandAlias: triangles-qt
ArchiveBinariesDependOnPath: true
InstallerUrl: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-6.1.7-win-x64.zip
InstallerUrl: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-6.2.0-win-x64.zip
InstallerSha256: 6F002A669A7E92AAF3D8DD7B1AE80F06A086C99A15CA05CF107665009FFC06B7
ManifestType: singleton
ManifestVersion: 1.6.0
+180
View File
@@ -0,0 +1,180 @@
# AVX-512 SIGILL build fix — `-mno-avx512f` belt-and-suspenders
**TL;DR:** GCC 11+ on an AVX-512-capable CI runner will emit AVX-512
instructions in libstdc++-inlined `std::string` / `std::copy` / `memcpy` code
paths even when `-march=x86-64-v2 -mtune=generic` is set globally. The
resulting binary crashes with `SIGILL (Illegal instruction)` on every
production node that lacks AVX-512 (KVM EPYC, Ryzen 3600, ARM64, anything
pre-Skylake-X). The fix is to add `-mno-avx512f -mno-avx512*` to the
global compile options. **Don't trust `-march=x86-64-v2` alone** — it sets
the baseline ISA but does not prevent auto-vectorization from emitting
higher-ISA instructions.
## Symptom (v6.1.9, 2026-07-31)
DNS2 attempted to install the v6.1.9 `.deb`. Daemon started and died
immediately with `status=4/ILL` (illegal instruction), before reaching
`main()`. The systemd journal showed:
```
Aug 01 04:38:28 vmi3080415 trianglesd[367821]: status=4/ILL
```
The daemon was previously working on v6.1.4.0. The only thing that
changed was the binary.
## Diagnosis recipe (15 minutes)
```bash
# 1. Reproduce the crash under gdb so you can see the failing instruction
systemctl stop trianglesd
sleep 3
gdb --batch \
-ex "set startup-with-shell off" \
-ex "run -datadir=/root/.triangles -conf=/root/.triangles/triangles.conf" \
-ex "info symbol \$pc" \
-ex "x/3i \$pc" \
-ex "x/8bx \$pc-4" \
/usr/lib/cryptographic-triangles/trianglesd 2>&1 | tail -15
```
You will see something like:
```
Program received signal SIGILL, Illegal instruction.
0x00005555556bbe49 in ?? ()
No symbol matches $pc.
=> 0x5555556bbe49: vpbroadcastq %rax,%xmm0
0x5555556bbe4f: sub %r14,%rdx
0x5555556bbe52: test %rdx,%rdx
0x5555556bbe45: 0x08 0x49 0x89 0xc4 0x62 0xf2 0xfd 0x08
```
The bytes `0x62 0xf2 0xfd 0x08` are the **EVEX prefix** — an AVX-512
encoding. The disassembled instruction `vpbroadcastq %rax, %xmm0` is
the broadcast form, which uses EVEX even when the destination is XMM.
## Why this happens
The Triangles cmake file `cmake/AddCompilerFlags.cmake` already sets
`-march=x86-64-v2 -mtune=generic` for `x86_64 && NOT WIN32 && NOT APPLE`:
```cmake
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$" AND NOT WIN32 AND NOT APPLE)
option(CMAKE_X86_64_BASELINE "..." ON)
if(CMAKE_X86_64_BASELINE)
add_compile_options(-march=x86-64-v2)
add_compile_options(-mtune=generic)
endif()
endif()
```
`-march=x86-64-v2` sets the **baseline ISA** to ~Nehalem (SSE4.2 + POPCNT +
CMPXCHG16B). GCC should not emit anything higher. In practice GCC 11.4 +
`-O3` + libstdc++ inlining of `std::string::operator=`, `std::copy`, and
`memcpy` patterns from libstdc++ headers that contain `#pragma GCC
push_options` blocks for AVX-512 detection — together they emit
`vpbroadcastq` EVEX instructions into user code via header inlining.
The instruction comes from **libstdc++ inlining**, not from any
Triangles-specific source. The disassembly shows the inlined function
is in a region marked as `std::string::operator=(std::string&&) + 0x2610`
because the symbol table merges the entire `.text` into the closest
named symbol — but the AVX-512 instruction itself is in a Triangles
translation unit (the call chain eventually reaches it from
`main.cpp`/`net.cpp` via `std::string` operations on the onion/I2P
addrman paths).
## The fix
Add an explicit `-mno-avx512*` family block to
`cmake/AddCompilerFlags.cmake` inside the existing
`CMAKE_X86_64_BASELINE` block:
```cmake
if(CMAKE_X86_64_BASELINE)
add_compile_options(-march=x86-64-v2)
add_compile_options(-mtune=generic)
# Belt-and-suspenders: GCC 11+ can autovectorize libstdc++
# std::string / std::copy / memcpy paths into AVX-512 EVEX
# instructions even when -march=x86-64-v2 is set. Force-disable
# the whole AVX-512 family so a CI runner's EPYC 7763 (or any
# AVX-512-capable build host) cannot leak AVX-512 into a binary
# that needs to run on KVM EPYC, Ryzen 3000, or ARM64.
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")
add_compile_options(
-mno-avx512f -mno-avx512pf -mno-avx512er -mno-avx512cd
-mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma
-mno-avx512vbmi -mno-avx512vbmi2 -mno-avx512vnni
-mno-avx512bitalg -mno-avx512vpopcntdq -mno-avx512-4fmaps
-mno-avx512-4vnniw -mno-avx512vp2intersect
)
endif()
endif()
```
`-mno-avx512f` is the critical one (it's the foundation of the family).
The others cover AVX-512 sub-features GCC may emit. The clang-equivalent
of this is `-mno-avx512f -mno-avx512fp16 -mno-avx512pf -mno-avx512er
-mno-avx512cd -mno-avx512vl -mno-avx512bw -mno-avx512dq -mno-avx512ifma`
but this Triangles fix is GCC-only because the existing code already
guards on `CMAKE_CXX_COMPILER_ID STREQUAL "GNU"`.
## Verify the fix landed in the new binary
```bash
# Build, install, then check for EVEX-encoded instructions
objdump -d /usr/lib/cryptographic-triangles/trianglesd 2>/dev/null \
| grep -c "vpbroadcastq"
# Expected: 0 (was 741 before the fix)
# Also check for any other EVEX-encoded instructions
objdump -d /usr/lib/cryptographic-triangles/trianglesd 2>/dev/null \
| grep -E "vpcompress|vpdpwssd|vpdpbusd|gfni|vaes|vpclmulqdq" | head
# Expected: empty
```
The smoke test that should have caught this: **add a job to the
`Build All Platforms` workflow that runs the resulting trianglesd
binary on a non-AVX-512 runner before publishing artifacts.** Catches
this class of bug forever.
## Why this wasn't caught before
GitHub Actions' hosted `ubuntu-22.04` runner is an AMD EPYC 7763 (Zen 3,
AVX-512 capable). Every CI build worked because the runner has the
required ISA. No unit test actually runs the produced binary, so the
build-vs-run gap is invisible until the binary ships to a CPU without
AVX-512 (which is most production hardware, including KVM-virtualized
EPYC, Ryzen 3000/5000 series, and ARM64 nodes). The fix is both the
cmake `-mno-avx512f` belt and a CI smoke-test step that executes the
binary on a non-AVX-512 runner.
## Files changed for v6.2.0
- `cmake/AddCompilerFlags.cmake` — added the `-mno-avx512*` block
- `src/clientversion.h` — bumped to 6.2.0.0
- All version-bearing files updated by `./scripts/bump-version.sh 6.2.0`
## Pitfall — don't do these things
- **Don't just add `-march=x86-64-v2`** without also adding
`-mno-avx512*`. The march alone is not enough on GCC 11+ with libstdc++
inlining. The behavior was verified locally: `-march=x86-64-v2` alone
still produced 741 AVX-512 instructions in the test build.
- **Don't add `-fno-tree-vectorize`** to "fix" the symptom. That would
regress performance across the whole daemon. `-mno-avx512f` is the
surgical fix.
- **Don't use `set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-avx512f")`**.
`add_compile_options` is the correct API — it propagates to subdirectory
targets (libsecp256k1, libtor, etc.) that were the actual sources of
the AVX-512 in earlier sessions.
## Cross-references
- The Triangles release v6.1.9 was the first release with the staking-
selfheal fix (`f69f087 [grade=B] fix(staking): carve out caught-up
nodes from IBD gate so chain can self-heal`). v6.1.9 was the binary
that exhibited this bug; v6.2.0 carries both the staking fix AND this
build-portability fix.
- The git history for this fix is the v6.2.0 release.
+5 -5
View File
@@ -1,6 +1,6 @@
name: triangles
base: core22
version: '6.1.7'
version: '6.2.0'
summary: Cryptographic Triangles (TRI) cryptocurrency wallet
description: |
Privacy-focused cryptocurrency featuring Proof-of-Stake consensus,
@@ -51,10 +51,10 @@ apps:
parts:
triangles:
plugin: dump
source: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-v6.1.7-linux-x64-qt
source: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-v6.2.0-linux-x64-qt
source-type: file
organize:
Cryptographic-Triangles-v6.1.7-linux-x64-qt: bin/triangles-qt
Cryptographic-Triangles-v6.2.0-linux-x64-qt: bin/triangles-qt
stage-packages:
- libqt5widgets5
- libqt5gui5
@@ -73,10 +73,10 @@ parts:
trianglesd:
plugin: dump
source: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.1.7/Cryptographic-Triangles-v6.1.7-linux-x64-daemon
source: https://github.com/SamiAhmed7777/triangles_v5/releases/download/v6.2.0/Cryptographic-Triangles-v6.2.0-linux-x64-daemon
source-type: file
organize:
Cryptographic-Triangles-v6.1.7-linux-x64-daemon: bin/trianglesd
Cryptographic-Triangles-v6.2.0-linux-x64-daemon: bin/trianglesd
desktop-entry:
plugin: dump
+4 -4
View File
@@ -6,10 +6,10 @@
//
// These need to be macros, as version.cpp's and triangles-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 6
#define CLIENT_VERSION_MINOR 1
#define CLIENT_VERSION_REVISION 9
#define CLIENT_VERSION_BUILD 0
#define CLIENT_VERSION_MAJOR 6
#define CLIENT_VERSION_MINOR 2
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!