AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Low 36 Bitcoin

fix(core): make the GFXMMU frame buffers writable by the T3W1 application

Public commit record

What the developer wrote

Authored by tychovrahe

97/100 · Strong
fix(core): make the GFXMMU frame buffers writable by the T3W1 application

On T3W1 every pixel the application wrote to the frame buffer with the CPU
was silently lost; only DMA2D transfers reached it. The anti-aliased edges
of rounded rectangles and circles, and the blur, were missing on hardware,
which the dark theme hid.

The GFXMMU stayed privileged-only. Its privilege attribute lives in the
GTZC TZSC, and the secure monitor locks the TZSC configuration (LCK, until
reset) at the end of its init, so the non-secure kernel's attempt in
display_set_unpriv_access() to make it unprivileged was refused. An
unprivileged access to a privileged resource is a silent fail (RM0456
5.4.2): reads return zero, writes are ignored, no event is raised, so no
fault ever pointed at it.

Configure the frame buffer access in tz_init() instead, on every layout:
the secure monitor before it locks the TZSC, the secure kernel of the
non-secmon layouts at its start. Unprivilege the physical frame buffers
first, so that the GFXMMU's own bus transactions (the LTDC refresh; a
securable peripheral that is a bus master issues transactions with its
TZSC privilege, RM0456 3.6.3) stay legal, then the GFXMMU. The MPU keeps
gating which buffer the application may touch. The regions come from the
model's memory layout, so display_set_unpriv_access() and its driver
implementations go away. tz_set_sram_unpriv() gets the same secure/
non-secure alias handling as tz_set_sram_unsecure() so the monitor can
name the buffers by their non-secure addresses.

Move the TZSC privilege setters (SAES, TAMP, GFXMMU) out of the shared
sys/trustzone module into sec/trustzone (sec/tz_periph.h), available to
secure builds only, so a non-secure build that calls one fails to compile
instead of failing silently at runtime. They now also refuse to run once the
TZSC is locked, and the SAES and TAMP ones are not built into the secure
monitor, which has no caller for them. Gate the secure AES unprivileged
path, their other caller, on secure mode the same way; it is only reachable
from secure-only code anyway.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

[no changelog]
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Uses a recognizable type or scope✓ Provides detailed explanatory context✓ Explains rationale or failure mode
The short version

What changed, and why it matters

This commit fixes a display bug on the Trezor T3W1 hardware where the application could not directly write to the screen's frame buffer. Because of a TrustZone security-controller misconfiguration, CPU-drawn pixels were silently ignored, so only graphics copied by the DMA engine showed up. The patch moves the privilege setup to the correct early initialization stage and removes a broken runtime path that could not work once the controller was locked. It also hardens the code so future mistakes cause compile-time or runtime failures instead of silent no-ops.

Recommended action

Treat this as a security-hardening bug fix. Verify that T3W1 firmware built from this commit correctly renders anti-aliased edges, circles, and blur under both light and dark themes. Review whether the silent-failure behavior could have masked any other access-control misconfigurations elsewhere in the TrustZone setup, and consider auditing other late TZSC changes for similar lock-window issues.

Security signals we found

01

Silent access-control failure: unprivileged access to a privileged TrustZone resource produced no fault, only zero reads and ignored writes

02

Privilege configuration window missed: TZSC locked before intended unprivileging, leaving resource over-privileged from application's view

03

Defense-in-depth improvement: moved TZSC privilege setters to secure-only build, preventing non-secure code from compiling a call that would silently fail at runtime

04

Added explicit TZSC lock check (tzsc_ensure_unlocked) to turn silent ignored writes into a fatal error

05

Correct ordering of SRAM vs GFXMMU unprivileging to maintain legal LTDC refresh bus transactions

Risk score

Why this scored 36/100

Our methodology →
Potential impact 8/30
Exploitability 4/25
Stealth signal 7/15
Affected reach 6/15
Confidence 7/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.