HomeARM CourseDay 23
DAY 23 · SYSTEM & MEMORY

TrustZone — Security in the Architecture

By EcrioniX · Updated Jun 6, 2026

Your phone stores fingerprints, payment tokens and DRM keys. Even if a hacker fully owns Android, those secrets must stay safe. How? ARM builds a second, isolated computer inside the same chip — TrustZone. It's one of the most important security ideas in modern silicon.

1. Two worlds on one processor

TrustZone splits the entire system into two worlds:

The crucial guarantee: Normal-world software physically cannot read or write Secure-world memory or peripherals. This isn't enforced by the OS (which could be hacked) — it's enforced by hardware.

NORMAL WORLD Rich OS (Android / Linux) Apps & drivers 🔒 SECURE WORLD Trusted OS (TEE) Keys · crypto · secure boot SecureMonitor The only door between worlds — crossed via the SMC instruction
Figure — Two isolated worlds on one core; the Secure Monitor is the single controlled gateway.

2. The NS bit — security on the bus

How does hardware know which world it's in? A single signal: the NS (Non-Secure) bit. It tracks the current world and — crucially — propagates across the system bus (AMBA, Day 19). Every memory and peripheral access carries its NS state, so RAM regions and devices can be tagged secure or non-secure. A non-secure access to a secure address is blocked by hardware, full stop.

3. Crossing worlds: the Secure Monitor & SMC

You can't just jump between worlds — that would defeat the isolation. On Cortex-A, the only gateway is the Secure Monitor, tiny trusted code in the most privileged Monitor mode. Software requests a crossing with the SMC (Secure Monitor Call) instruction; the Monitor carefully saves and restores state as it passes control between worlds.

; Normal-world OS asks the Secure world to do something sensitive MOV r0, #SMC_DECRYPT_KEY ; which secure service SMC #0 ; trap to the Secure Monitor → Secure world ; ... Secure world does the work without ever exposing the key ... ; control returns here, in the Normal world

4. The TEE — what runs in the Secure world

The Secure world hosts a Trusted Execution Environment (TEE) — a minimal trusted OS (e.g. OP-TEE) running small trusted applications. Real uses you rely on daily:

5. Secure boot — the root of trust

Security means nothing if the secure code itself is tampered with. Secure boot establishes a chain of trust: an immutable boot ROM (Day 25) verifies the next stage's signature before running it, which verifies the next, and so on. TrustZone's Secure world is brought up first, under this verified chain, so trusted code is genuine before the Normal world even starts.

6. Cortex-M TrustZone (TrustZone-M)

Microcontrollers got their own, lighter variant in ARMv8-M. Instead of a Secure Monitor and worlds you switch via SMC, TrustZone-M divides the memory map into secure/non-secure regions and lets calls cross at special NSC (Non-Secure Callable) entry points with very low overhead — security for tiny IoT devices without a heavyweight TEE.

✅ The mental model

TrustZone is a hardware-enforced second computer inside the chip: a Secure world the Normal world can never peek into, tracked by the NS bit across the whole bus. Worlds cross only through the Secure Monitor via SMC, the Secure world runs a TEE for keys/payments/biometrics, and secure boot guarantees that trusted code is authentic.

🎯 Day 23 takeaways

Quick check

  1. Why must world isolation be enforced by hardware, not the OS?
  2. What does the NS bit do beyond the core itself?
  3. Which instruction requests a switch to the Secure world on Cortex-A?

FAQ

What is TrustZone?

A hardware feature splitting the system into an isolated Secure world and a Normal world, so trusted code/secrets stay safe even if the main OS is compromised.

What is the NS bit?

The Non-Secure signal marking the current world; it propagates on the bus so hardware can block non-secure access to secure resources.

What is a TEE?

The Trusted Execution Environment — the Secure-world OS where keys, payments and biometrics are handled in isolation.

Previous
← Day 22: Caches in ARM

← Back to the full course roadmap