Merge pull request #2093 from binwiederhier/sigill-2092

Check the amd64 binary on a baseline x86-64 CPU after every build
This commit is contained in:
Philipp C. Heckel authored and GitHub committed 2026-10-22 22:33:03 -04:00
commit 2012d3e09a
3 files changed
+26

No files matched your search

+4
View File
@@ -13,6 +13,10 @@ builds:
- "-linkmode=external -extldflags=-static -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
goos: [ linux ]
goarch: [ amd64 ]
hooks:
post:
- cmd: ./scripts/check-cpu-baseline.sh "{{ .Path }}" # catch x86-64-v3 C code, see #2092
output: true
- id: ntfy_linux_armv6
binary: ntfy
env:
+1
View File
@@ -117,6 +117,7 @@ build-deps-ubuntu:
gcc-mingw-w64-x86-64 \
python3 \
python3-venv \
qemu-user \
jq
which pip3 || sudo apt-get install -y python3-pip
+21
View File
@@ -0,0 +1,21 @@
#!/bin/bash
# Runs an amd64 binary on an emulated baseline x86-64 CPU (qemu64: no AVX2, BMI2, MOVBE), to catch
# statically linked C code (glibc, SQLite) that was built for newer CPUs, see #2092.
#
# Fails without qemu-x86_64 in CI (CI is set by GitHub Actions), skips with a warning elsewhere.
set -euo pipefail
binary="$1"
if ! command -v qemu-x86_64 >/dev/null; then
if [ -n "${CI:-}" ]; then
echo "ERROR: qemu-x86_64 not found, cannot check $binary on a baseline x86-64 CPU. On Ubuntu, run: apt install qemu-user"
exit 1
fi
echo "WARNING: qemu-x86_64 not found, skipping baseline x86-64 CPU check of $binary"
exit 0
fi
if ! qemu-x86_64 -cpu qemu64 "$binary" --help >/dev/null; then
echo "ERROR: $binary does not run on a baseline x86-64 CPU (qemu64), it likely contains x86-64-v3 instructions (see #2092)"
exit 1
fi
echo "$binary runs on a baseline x86-64 CPU (qemu64)"