feat(vendor): disable traceback allocation in `PYOPT=1` builds
What changed, and why it matters
This commit changes the Trezor firmware's embedded MicroPython configuration so that detailed error tracebacks are no longer stored in optimized (PYOPT=1) builds. The stated goal is to avoid allocating traceback data in release builds, which can save memory and reduce information exposure if an error occurs. There is no direct evidence in the commit that this fixes an active security vulnerability, but it is a defensive hardening measure.
Treat as a minor hardening improvement. Review the corresponding MicroPython submodule commit to confirm whether traceback disabling was newly introduced or just configured. No urgent action required unless traceback data was previously shown to leak sensitive runtime information.
Security signals we found
Disables traceback allocation in optimized/production builds
Reduces potential information disclosure via exception tracebacks
Saves runtime memory in constrained embedded environment
Changelog categorizes under '.fixed' suggesting a bug or hardening fix
Evidence from the diff
The patch adds MICROPY_PY_SYS_TRACEBACK_DISABLE (PYOPT) to both the firmware and Unix port MicroPython configuration headers. This disables traceback allocation when PYOPT is enabled (optimized builds). The changelog entry describes it as ‘Don’t allocate tracebacks in optimized builds.’ The actual MicroPython submodule change is not shown in the diff, only the Trezor-side configuration and changelog.
Changed components
core/embed/projects/firmware/mpconfigport.hcore/embed/projects/unix/mpconfigport.hvendor/micropython (submodule configuration)Inspect captured patch +8 / −1
diff --git a/core/.changelog.d/5526.fixed b/core/.changelog.d/5526.fixed
new file mode 100644
index 00000000..901b8520
--- /dev/null
+++ b/core/.changelog.d/5526.fixed
@@ -0,0 +1 @@
+Don't allocate tracebacks in optimized builds.
diff --git a/core/embed/projects/firmware/mpconfigport.h b/core/embed/projects/firmware/mpconfigport.h
index f5f24d3f..8af745ef 100644
--- a/core/embed/projects/firmware/mpconfigport.h
+++ b/core/embed/projects/firmware/mpconfigport.h
@@ -161,6 +161,9 @@
#define MICROPY_PY_USOCKET (0)
#define MICROPY_PY_NETWORK (0)
+// allocate traceback data only on debug builds
+#define MICROPY_PY_SYS_TRACEBACK_DISABLE (PYOPT)
+
#define MICROPY_PY_TREZORCONFIG (1)
#define MICROPY_PY_TREZORCRYPTO (1)
#define MICROPY_PY_TREZORIO (1)
diff --git a/core/embed/projects/unix/mpconfigport.h b/core/embed/projects/unix/mpconfigport.h
index 3b628608..0485f1b7 100644
--- a/core/embed/projects/unix/mpconfigport.h
+++ b/core/embed/projects/unix/mpconfigport.h
@@ -175,6 +175,9 @@
#define MICROPY_PY_USOCKET (0)
#define MICROPY_PY_NETWORK (0)
+// allocate traceback data only on debug builds
+#define MICROPY_PY_SYS_TRACEBACK_DISABLE (PYOPT)
+
// Debugging and interactive functionality.
#define MICROPY_DEBUG_PRINTERS (1)
// Printing debug to stderr may give tests which
Why this scored 26/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.