feat(core/prodtest): Allocate larger stack for ML-DSA.
What changed, and why it matters
This commit increases the memory reserved for the production-test firmware's call stack from 24 KB to 128 KB and moves it from MAIN_RAM to AUX1_RAM. The stated reason is to support ML-DSA (a post-quantum digital-signature algorithm) operations that need more stack space. A stack that is too small can trigger a UsageFault crash; the change prevents such crashes during production testing. There is no direct evidence in the commit that this fixes an exploitable security vulnerability, but running with an undersized stack can in some cases lead to memory corruption or unstable behavior.
Treat as a low-severity hardening fix. Verify that AUX1_RAM is large enough and properly initialized for the prodtest image, and that moving the stack does not conflict with other sections. Review whether the original 24 KB stack could have caused observable crashes or memory corruption during ML-DSA signing/keygen in production-test workflows.
Security signals we found
Stack size increase in embedded firmware linker script
Comment explicitly notes 'Overflow causes UsageFault'
Memory region moved from MAIN_RAM to AUX1_RAM
ML-DSA mentioned as driver for larger stack requirement
No changelog entry ([no changelog])
Evidence from the diff
The linker script for the STM32U5G prodtest image (core/embed/sys/linker/stm32u5g/prodtest.ld) is modified: the .stack section grows from 0x6000 (24 KiB) to 0x20000 (128 KiB) and is relocated from MAIN_RAM to AUX1_RAM. The comment ‘Overflow causes UsageFault’ is preserved. The change is framed as enabling ML-DSA stack requirements. This is a hardening/resource-allocation fix rather than a logic-level bug fix; it mitigates the risk of stack overflow/UsageFault during prodtest execution.
Changed components
Trezor Core production-test firmware (prodtest)STM32U5G linker script core/embed/sys/linker/stm32u5g/prodtest.ldML-DSA operations in prodtestInspect captured patch +2 / −2
diff --git a/core/embed/sys/linker/stm32u5g/prodtest.ld b/core/embed/sys/linker/stm32u5g/prodtest.ld
index 7984304f1..9f5221031 100644
--- a/core/embed/sys/linker/stm32u5g/prodtest.ld
+++ b/core/embed/sys/linker/stm32u5g/prodtest.ld
@@ -69,8 +69,8 @@ SECTIONS {
} >FLASH AT>FLASH
.stack : ALIGN(8) {
- . = 24K; /* Overflow causes UsageFault */
- } >MAIN_RAM
+ . = 128K; /* Overflow causes UsageFault */
+ } >AUX1_RAM
.data : ALIGN(4) {
*(.data*);
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.