build(core/rust): debug emulator should not immediately abort on panic
What changed, and why it matters
This change adjusts how the Trezor firmware's Rust code is built for the debug software emulator. Previously, all builds used a setting that makes the program immediately stop (abort) if a panic occurs. Now, the debug emulator keeps the normal panic mechanism so that internal debug assertions can be reported instead of silently crashing. This is a build/developer-experience change, not a fix for an exploitable security flaw in shipped hardware wallets.
No security response required. Treat as a normal build tooling change. If reviewing supply-chain integrity, verify that release builds still use panic_immediate_abort and that the debug emulator is not shipped to end users.
Security signals we found
Build configuration change only
Affects debug emulator profile only
No runtime code or cryptographic logic modified
No mention of vulnerability, CVE, or security fix in commit message
No changelog entry
Evidence from the diff
The commit modifies core/site_scons/tools.py so that the unstable Rust flags -Z build-std=core and -Z build-std-features=panic_immediate_abort are omitted only for build == "unix" with a debug profile. For release builds and non-unix targets, the immediate-abort panic behavior remains. The stated purpose is to preserve debug_assert! reporting on the debug emulator. The change does not alter runtime behavior of production firmware and does not address a disclosed vulnerability.
Changed components
core/site_scons/tools.pyRust build configuration for unix debug emulatorInspect captured patch +9 / −2
diff --git a/core/site_scons/tools.py b/core/site_scons/tools.py
index 5d9b6962..1bf8be08 100644
--- a/core/site_scons/tools.py
+++ b/core/site_scons/tools.py
@@ -153,9 +153,11 @@ def add_rust_lib(*, env, build, profile, features, all_paths, build_dir):
# Determine the profile build flags.
if profile == "release":
profile = "--release"
+ is_debug = False
RUST_LIBDIR = f"build/{build}/rust/{RUST_TARGET}/release"
else:
profile = ""
+ is_debug = True
RUST_LIBDIR = f"build/{build}/rust/{RUST_TARGET}/debug"
RUST_LIBPATH = f"{RUST_LIBDIR}/lib{RUST_LIB}.a"
@@ -168,9 +170,14 @@ def add_rust_lib(*, env, build, profile, features, all_paths, build_dir):
f"--target-dir=../../build/{build}/rust",
"--no-default-features",
"--features " + ",".join(lib_features),
- "-Z build-std=core",
- "-Z build-std-features=panic_immediate_abort",
]
+ if not (build == "unix" and is_debug):
+ # Keep panic mechanism on debug emulator (for `debug_assert!`)
+ cargo_opts += [
+ "-Z build-std=core",
+ "-Z build-std-features=panic_immediate_abort",
+ ]
+
build_cmd = f"cargo build {profile} " + " ".join(cargo_opts)
unstable_rustc_flags = [
Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.