Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

4.2 Attribution: SAU, IDAU and the TT instructions

Two units attribute every address, and the PE combines their results:

  • The IDAU (Implementation Defined Attribution Unit) is a fixed or SoC-configured map outside the architecturally defined SAU. Its contents are IMPLEMENTATION DEFINED, and the signal interface is defined by the core (for example the Cortex-M33 IDAU interface), not by the architecture.
  • The SAU (Security Attribution Unit) is programmable from Secure privileged code. The number of regions is in SAU_TYPE.SREGION. You select a region with SAU_RNR, then program SAU_RBAR (base address) and SAU_RLAR (limit address, an NSC bit and ENABLE). Regions have 32-byte granularity. You turn the SAU on with SAU_CTRL.ENABLE. While the SAU is disabled, SAU_CTRL.ALLNS chooses whether it reports everything Secure (0) or everything Non-secure (1).

When the SAU is enabled, an address that no enabled region covers is Secure. Each unit returns one of three attributes, and the more secure result wins, ordered Secure > Non-secure-callable > Non-secure. Outside the architecturally exempt ranges, an address ends up Non-secure only when both units agree that it is Non-secure.

NSC memory is Secure memory with one exception: Non-secure code may branch into it, but only onto an SG instruction. NSC exists so that only regions you deliberately mark can act as entry points. Without it, any halfword pair in Secure code or data that happened to encode SG could become an entry point. Keep NSC regions small and fill them only with veneers.

The PE combines attribution with the MPU of the current state. The MPU is banked into a Secure and a Non-secure instance. The TT family of instructions lets software query both:

  • TT: MPU region and permissions for the current state, at the current privilege.
  • TTT: the same, but checks unprivileged permissions.
  • TTA and TTAT: query the Non-secure MPU (the alternate state), privileged and unprivileged respectively. These two are valid only in Secure state.

The result word reports MPU region and validity (MREGION, MRVALID), R and RW permissions and, in Secure state, SAU and IDAU region information, the S attribute, and the combined NSR and NSRW flags (MPU permission AND Non-secure attribution). Secure code uses these to validate pointers it receives from Non-secure callers.

Coming from A-profile: A TZASC filters bus transactions by an NS bit someone else already decided; the SAU instead decides the attribute the PE itself uses, for both instruction fetch and data access, and adds an NSC attribute that has no A-profile counterpart. TT/TTA play a role similar to AT S1E* address-translation queries, but they return region numbers and permissions instead of a PA.

Checkpoint

Q4.2.1 For a given address, the SAU result is Non-secure and the IDAU result is Non-secure-callable. What is the final attribution?

  • A. Non-secure-callable, because the more secure of the two results wins
  • B. Non-secure, because the programmable SAU overrides the IDAU
  • C. Secure, because a mismatch between the two units always defaults to Secure
  • D. UNPREDICTABLE, because the two units must agree
Answer

A. The combination rule takes the more secure attribute, ordered Secure > NSC > NS. NSC is more secure than NS, so NSC wins. The tempting idea that the programmable SAU overrides the IDAU is wrong: the SAU can only raise the security of an address the IDAU marks as less secure, never lower it.

Read more: Armv8-M ARM (DDI0553), Security attribution: SAU and IDAU

Q4.2.2 The SAU is enabled with regions covering only flash 0x00200000-0x003FFFFF (NS) and SRAM 0x20020000-0x2003FFFF (NS). The IDAU marks the whole of 0x20000000-0x2FFFFFFF as Non-secure. How is address 0x20000100 attributed?

  • A. Non-secure, because the IDAU says Non-secure and no SAU region contradicts it
  • B. Non-secure-callable, because it is next to an NS region
  • C. Secure, because an address that no enabled SAU region covers is Secure when the SAU is enabled, and the more secure result wins
  • D. It depends on whether the access is an instruction fetch or a data access
Answer

C. With SAU_CTRL.ENABLE=1, the SAU reports any address outside its enabled regions as Secure, so the combined result is Secure. The tempting reading is that “no SAU region” means the SAU has no opinion and the IDAU decides. That only applies to a disabled SAU with ALLNS=1.

Read more: Armv8-M ARM (DDI0553), SAU_CTRL, SAU_RLAR

Q4.2.3 A Secure entry function receives a buffer pointer from unprivileged Non-secure thread code. It must confirm that this code could legitimately write the whole buffer itself. Which instruction gives the right check per address?

  • A. TT, because it uses the caller’s privilege automatically
  • B. TTAT, which queries the Non-secure MPU with unprivileged permissions and also reports the Security attribute
  • C. TTT, which checks the Secure MPU with unprivileged permissions
  • D. TTA, which checks Non-secure privileged permissions
Answer

B. The question is whether Non-secure unprivileged code may write the buffer. That needs the alternate-state (Non-secure) MPU at unprivileged level, and attribution must show the address as Non-secure (NSRW). TTAT does exactly that, and it is valid only in Secure state. TTA is tempting, but it checks privileged permissions, so an unprivileged NS thread could get Secure code to write memory that only NS privileged code may write.

Read more: Armv8-M ARM (DDI0553), TT, TTT, TTA, TTAT instructions