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

14.6 Meltdown-class leaks

Spectre variants make the victim run code it should not. Meltdown-class leaks are different: the attacker’s own instruction reads something it has no right to read, and the core forwards the value to younger instructions before it raises the fault. Nothing needs training. The required hardware behaviour is fault deferral, the last structure row in the table in 14.1. Among Arm-designed cores the exposure is small and well bounded, and that is the main point of this section: know exactly which cores and which boundaries are affected, so firmware neither ignores the problem nor copies OS-level mitigations it does not need.

Variant 3: rogue data cache load (CVE-2017-5754)

    // EL0, kernel VA in x1 (mapped in TTBR1_EL1, AP = privileged-only)
    ldrb    w2, [x1]            // permission fault, but only at commit
    lsl     x2, x2, #6
    ldrb    w3, [x9, x2]        // transient: probe line indexed by the secret

The attack needs the victim data to be mapped in the attacker’s current translation regime, with only the permission check standing in the way. In the EL1&0 regime the kernel is mapped (TTBR1) while EL0 runs, so EL0 can attack EL1. Among Arm’s own cores, the Arm security bulletin lists Cortex-A75 as the only one affected by variant 3. Other implementers’ cores are a separate question; Linux keeps a MIDR safe-list and otherwise defers to CSV3.

What variant 3 cannot do on any core:

  • Reach EL3 or Secure memory from the Non-secure world. EL3 has its own regime, and Secure PAs are not mapped in any Non-secure translation. TF-A’s advisory says plainly that variant 3 “is not applicable” to TF-A for this reason.
  • Cross from EL1 to EL2. EL2 uses a separate regime, apart from the EL2&0 regime under VHE, where the same EL0-vs-EL2 problem reappears.

Security note: The Secure world has its own EL0/EL1 boundary. A trusted application at S-EL0 on a Cortex-A75 can read S-EL1 (Trusted OS) memory exactly as Non-secure EL0 can read the kernel. TF-A explicitly leaves that to the Secure Payload. OP-TEE’s answer is CFG_CORE_UNMAP_CORE_AT_EL0, the S-EL1 equivalent of KPTI. If you review a Trusted OS for an A75-based SoC, check that this, or an equivalent, is on.

Variant 3a: rogue system register read (CVE-2018-3640)

Here the “load” is an MRS of a system register that the current EL is not allowed to read. On affected cores the value is forwarded speculatively before the trap or UNDEFINED exception is taken. Among Arm cores, Cortex-A57 and Cortex-A72 are affected in AArch64 (Cortex-A15 in AArch32).

The leak is register contents, not memory. Few system registers hold secrets, but several hold layout: VBAR_EL1, VBAR_EL2, TTBRx_ELy. That makes 3a a KASLR or hypervisor-layout leak. Linux’s response (ARM64_SPECTRE_V3A, matched by MIDR on A57/A72) is to run KVM’s hypervisor vectors from a separate, randomised mapping, so that VBAR_EL2 no longer reveals where EL2 code lives. TF-A’s position is that software mitigation is generally not believed necessary.

Bring-up note: Do not keep secrets in system registers that are readable, under 3a, from a less privileged EL on A57/A72. Two examples are a key parked in an IMPLEMENTATION DEFINED scratch register, and a pointer to secret data in TPIDR_EL1 used as a “hidden” location. The architectural trap does not protect the value from a speculative read on these cores.

KPTI: the OS-level fix

Kernel page-table isolation removes the kernel from the EL1&0 regime while EL0 runs, so a variant 3 load finds no mapping at all. On arm64 Linux:

  • While EL0 runs, TTBR1_EL1 points at a trampoline page table that maps only the trampoline vectors (tramp_vectors) and the minimum needed to switch.
  • The trampoline vector entry writes TTBR1_EL1 to the real kernel table, issues an ISB, and branches into the normal vectors. Exit does the reverse.
  • Kernel mappings are made nG, and each process gets an ASID pair (user and kernel ASIDs differ in bit 0). Switching tables then needs no TLBI: TCR_EL1.A1 selects the ASID from TTBR1_EL1, and the trampoline flips the ASID together with the base address (9.1).

The cost is two TTBR writes and two ISBs per kernel crossing, plus TLB pressure from nG kernel mappings. Linux decides per system (unmap_kernel_at_el0() in cpufeature.c, with kaslr_requires_kpti()) as follows:

ConditionKPTI?
Every core has ID_AA64PFR0_EL1.CSV3 = 1 or is on the MIDR safe-list (A35/A53/A55/A57/A72/A73 and others)Not needed for Meltdown
KASLR enabled and the core lacks FEAT_E0PDOn anyway, to protect KASLR from timing attacks
A core is affected by CVE-2024-7881 and firmware does not advertise SMCCC_ARCH_WORKAROUND_4On, but only in kernels carrying the January 2025 patch series that proposed this (queued on an arm64 topic branch; not in every mainline or vendor kernel, so check yours)
kpti= on the command lineForced either way

KPTI is a kernel matter. EL3 firmware has nothing to do for it except to avoid breaking its assumptions, for example by not mapping firmware-shared buffers into the trampoline view.

FEAT_CSV3: the architectural “not affected”

ID_AA64PFR0_EL1.CSV3 (bits [63:60]) = 0b0001 means, in current issues of the register description: data loaded or read from a register under speculation, where the load or register read would not be permitted architecturally, cannot be used by newer instructions in a manner that allows the value of the inaccessible data to be recovered by code architecturally executed. Older issues worded it more narrowly, as data loaded with a permission or domain fault that cannot be used to form an address, generate condition codes or SVE predicate values, or affect the timing of other instructions. 0b0000 means the PE does not disclose. It does not mean “vulnerable”.

  • Permitted from v8.0. From v8.5 the value 0b0000 is not permitted, so CSV3 is effectively mandatory from v8.5.
  • It is what lets an OS drop KPTI. The current wording also names register reads, so on a core that reports CSV3 = 1 against that wording, variant 3a is covered too. Older issues spoke only of faulting loads, so check which wording your DDI0487 issue and the core’s TRM use before relying on CSV3 for 3a. Linux identifies 3a by MIDR (A57/A72, which report 0), not by CSV3. For an older core reporting 0, the security bulletin and the TRM are the authority (14.7).

FEAT_E0PD: faulting EL0 accesses to the kernel half

FEAT_E0PD is permitted from v8.4 and mandatory from v8.5 (ID_AA64MMFR2_EL1.E0PD, bits [63:60]). It adds TCR_EL1.E0PD0 (bit 55) and TCR_EL1.E0PD1 (bit 56), and the same fields in TCR_EL2 for the EL2&0 regime. With E0PD1 = 1, any EL0 access to an address translated through TTBR1_EL1 takes a level 0 Translation fault, whether or not the address is mapped. The point is that the fault should take the same time to generate whether or not the address is in the TLB (the register description words this as a “should”, not a “must”), so its timing does not reveal whether a translation exists or is cached. These faults are also not counted as TLB misses by the PMU. DDI0487 describes this under TCR_EL1.E0PDx.

E0PD is aimed at the other Meltdown-adjacent leak, which is probing the kernel layout by timing faulting accesses or prefetches, the classic KASLR break. It is not a variant 3 fix on its own. The ID register text, however, ties it to one: if FEAT_E0PD is implemented, FEAT_CSV3 must be implemented. A core with E0PD is therefore not variant-3 vulnerable, and E0PD replaces the remaining reason for KPTI (KASLR robustness) at no per-crossing cost.

    // EL1 init on a v8.5+ core: fault EL0 accesses to the TTBR1 half
    mrs     x0, tcr_el1
    orr     x0, x0, #(1 << 56)      // TCR_EL1.E0PD1
    msr     tcr_el1, x0
    isb

CVE-2024-7881: a leak with no speculation

TF-A advisory TFV-13 describes a newer issue in the same class. On some cores (Cortex-X3, X4, X925 and Neoverse V2, V3, V3AE), an unprivileged context can make the data memory-dependent prefetcher fetch a privileged location and then use the contents as an address that it also dereferences. The fill reveals the value. No instruction executes transiently at all. The mitigation is an IMPLEMENTATION DEFINED disable applied by EL3 at reset (on Neoverse V2, TF-A sets CPUACTLR6_EL1 bit 41). SMCCC_ARCH_WORKAROUND_4 (0x80000004) exists for discovery only: in TF-A, SMCCC_ARCH_FEATURES returns 0 on an affected PE where the firmware mitigation is in place and NOT_SUPPORTED (-1) on an unaffected PE, and calling the function does nothing. A 2025 Linux patch series makes the kernel fall back to KPTI on affected cores when discovery does not return 0. Whether your kernel carries it is a per-tree question; it is not in every mainline release.

Validation note: For each Meltdown-class item, the deliverable is a table, per core type and revision, with three columns: the ID field (CSV3, E0PD), the bulletin status, and what the firmware or OS does. Test it from both ends. From EL1, check that SMCCC_ARCH_FEATURES(0x80000004) returns 0 on affected cores and that Linux reports /sys/devices/system/cpu/vulnerabilities/meltdown as expected. On silicon, run a Flush+Reload variant 3 test from EL0 against a privileged-only kernel page with KPTI forced off. On a CSV3 core it must give no signal. On A75 with KPTI off it should give a signal, which proves the test works. For E0PD, check that an EL0 access to a TTBR1 address reports a level 0 Translation fault (ESR_EL1.ISS.DFSC = 0b000100) whether or not the page is mapped.

Not a speculation mitigation: PSTATE.DIT

This topic is unrelated to Meltdown and is kept here only because reviewers often confuse it with one. Data-independent timing is a promise about architecturally executed instructions. With PSTATE.DIT = 1, the architecture requires two things. The timing of every load and store is insensitive to the data value loaded or stored, though not to the address. For certain data-processing instructions, the time taken is independent of the values in their registers and of NZCV. Which instructions are covered is stated in each instruction’s “Operational information” in DDI0487, and the list is collected under “About PSTATE.DIT”. Check it before relying on a particular instruction, rather than assuming that all of integer, SIMD or crypto is covered. It is what constant-time cryptography assumes, and on a core that does early-out multiplies it is otherwise false.

  • FEAT_DIT, ID_AA64PFR0_EL1.DIT (bits [51:48]). The value 0b0000 is not permitted from v8.4, so it is mandatory from v8.4. PSTATE.DIT is SPSR bit 24.
  • Accessed with MSR DIT, #imm and MRS/MSR DIT, permitted at EL0.
  • Exception entry does not change it. The handler keeps the interrupted context’s value until it sets its own. TF-A therefore sets DIT = 1 on every EL3 entry (ENABLE_FEAT_DIT), and Linux does the same on kernel entry.

What DIT does not do: it does nothing for timing that depends on addresses (table lookups indexed by a secret), on branches on secrets, or on anything transient. Constant-time code still needs constant-time algorithms. DIT only removes the hidden data-dependent latency of individual instructions.

Checkpoint

Q14.6.1 A Cortex-A75 SoC runs TF-A at EL3, OP-TEE at S-EL1 with TAs at S-EL0, and Linux with KPTI enabled. Which boundary is still exposed to variant 3 if nothing else is done?

  • A. Non-secure EL0 reading EL3 memory, because EL3 does not use KPTI
  • B. S-EL0 trusted applications reading S-EL1 (OP-TEE core) memory
  • C. Non-secure EL1 reading Secure memory through a speculative walk
  • D. None, because KPTI in Linux protects the whole system
Answer

B. Variant 3 needs the target mapped in the attacker’s own regime, guarded only by a permission check. The Secure EL1&0 regime has that shape when OP-TEE’s core is mapped while TAs run, so OP-TEE needs CFG_CORE_UNMAP_CORE_AT_EL0. EL3 memory and Secure PAs are not mapped in any Non-secure regime, so A and C do not apply. D is wrong because Linux’s KPTI only changes the Non-secure EL1&0 tables.

Read more: Arm ARM (DDI0487), FEAT_CSV3; TF-A security advisory TFV-6 (variant 3)

Q14.6.2 On a v8.5 core with FEAT_E0PD, Linux disables KPTI even with KASLR on. What justifies dropping both reasons for KPTI?

  • A. E0PD prevents speculative loads from reading kernel data at EL0
  • B. E0PD unmaps the kernel from TTBR1_EL1 while EL0 runs
  • C. E0PD makes TTBR1_EL1 inaccessible to EL0 MRS, which closes variant 3a
  • D. E0PD makes every EL0 access to the TTBR1 half fault, with the fault intended to take the same time whether or not the address is mapped, which protects KASLR, and implementing E0PD requires CSV3, which covers variant 3
Answer

D. E0PD by itself addresses fault-timing layout probes. The Meltdown guarantee comes from the architectural rule that E0PD implies CSV3. A is the tempting option, but it attributes CSV3’s property to E0PD. B describes KPTI, and C is unrelated (TTBR1_EL1 was never EL0-readable architecturally).

Read more: Arm ARM (DDI0487), ID_AA64MMFR2_EL1.E0PD; TCR_EL1.E0PD1

Q14.6.3 An EL3 crypto service sets PSTATE.DIT = 1 once in its cold-boot path and assumes it stays set. What goes wrong?

  • A. Each later EL3 entry keeps the lower EL’s DIT value, which is restored from SPSR on every ERET, so the service may run with DIT=0
  • B. Nothing; DIT is a global control, so setting it once at EL3 covers all ELs
  • C. Exception entry always clears DIT, so the service always runs with DIT=0
  • D. DIT is RES0 at EL3
Answer

A. DIT is a PSTATE bit, saved to SPSR and restored by ERET. Exception entry leaves it unchanged, so EL3 inherits whatever the Non-secure caller had. That is why TF-A sets it on every entry. C is the tempting option, but entry does not clear it either. Assuming either fixed value is wrong.

Read more: Arm ARM (DDI0487), About PSTATE.DIT; AArch64.TakeException()