Skip to content

fix(transport): share one frame arena instead of a 12 KB stack frame - #344

Closed
BitHighlander wants to merge 1 commit into
feature/715-02-board-display-printffrom
feature/715-03-frame-arena
Closed

fix(transport): share one frame arena instead of a 12 KB stack frame#344
BitHighlander wants to merge 1 commit into
feature/715-02-board-display-printffrom
feature/715-03-frame-arena

Conversation

@BitHighlander

Copy link
Copy Markdown
Owner

7.15 review stack position 03/17.

This PR is intentionally one coherent commit, based on feature/715-02-board-display-printf, for individual auditing.
The full stack is linear from the clean fork develop at 1af2ffe.

Review scope: fix(transport): share one frame arena instead of a 12 KB stack frame.

The preserved pre-restage candidate remains available at preserve/alpha-2026-08-05.

msg_write() encoded outbound frames into a MAX_FRAME_SIZE TrezorFrameBuffer
declared as an automatic — a ~12.4 KB stack frame. With the Orchard engine
linked in, static SRAM left an ~11 KB gap and the device hard-faulted on boot
during RC7 bring-up.

Inbound reassembly, outbound encode and the recovery-cipher wordlist scratch
are mutually exclusive on a strictly cooperative single-threaded transport
(there is no USB ISR; usbd_poll runs only from explicit usbPoll call sites), so
they now share one static union. Acquiring the arena for TX or scratch drops any
partially reassembled inbound frame; only a host that pipelines a second request
before reading the first response can observe it, and it gets a Failure on its
next continuation frame rather than silent corruption.

The reassembly state moves to file scope so arena acquisition can invalidate it.
@BitHighlander

Copy link
Copy Markdown
Owner Author

Superseded by the smaller audit-ready 7.15 stack: #359 release foundation, #360 authenticated clear-signing, #361 recovery and entropy, #362 Zcash Orchard, #363 chain integrations, and #364 Bitcoin/release security. All release changes remain preserved in the replacement branches and preservation tags. The replacement aggregate was tree-verified against the prior release and passed the local CI-equivalent container suite (405 firmware, 2 board, 18 crypto, and 7 Pallas constant-time tests). GitHub-hosted checks have been explicitly dispatched and are currently queued.

@BitHighlander
BitHighlander deleted the feature/715-03-frame-arena branch August 9, 2026 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant