Skip to content

Commit 1557129

Browse files
committed
components: recover the arm64 image base from fault-path timing
A store to a kernel address from EL0 always faults, but the fault costs measurably more when the address is mapped: the translation walk completes and raises a permission fault, where an unmapped address terminates early with a translation fault at a higher level. Timing the faulting store distinguishes mapped from unmapped kernel pages without a cycle counter, which matters because PMCCNTR_EL0 is normally inaccessible from EL0; clock_gettime over a short run of faults suffices. Measured separation is 21% of the unmapped floor on a Cortex-A72 and 11% on a Cortex-A53, both timing a mapped address slower. The direction is taken from a reference probe of the linear map rather than assumed, since the published account reports it the other way. That reference probe doubles as the paging-mode detector: whichever VA_BITS candidate has a backed linear map identifies the mode, published as SF_VIRT_ADDR_BITS. Candidates are probed round-robin and normalised against each round's median, because cpufreq moves the floor by a factor of three and a per-candidate sweep attributes that drift to the candidate. The scan applies the same frequency-invariance, classifying against a rolling median of recent slots with the margin as a fraction of the local floor. The image is the left edge of an image-sized mapped run within the middle half of the vmalloc area, which is where kaslr_early_init places it. Confining the scan there is what separates the image from its neighbours: VMALLOC_START equals KIMAGE_VADDR, so the region opens with early vmalloc allocations that are themselves image-sized, and the two gigabytes below it are the module region. KPTI removes kernel tables from the EL0 page tables and the technique goes inert; arm64 forces KPTI on whenever KASLR is enabled unless the CPU implements E0PD, which serves the same purpose, so the live vantage is an explicit kpti=off or a build without CONFIG_UNMAP_KERNEL_AT_EL0. Detected KPTI is reported as a confirmed active mitigation. A kernel whose base is not randomized is declined before calibration from the command line and the FDT seed, rather than scanned for an image that is not in the window.
1 parent 3fa3fdf commit 1557129

4 files changed

Lines changed: 839 additions & 3 deletions

File tree

THIRD-PARTY-NOTICES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ basis for each.
2222
| `bcm_msg_head_struct` | Norbert Slusarek | https://www.openwall.com/lists/oss-security/2021/06/15/1/2 | Adapted from the author's minimal bug reproducer (CVE-2021-34693) and reimplemented. |
2323
| `sysfs_kernel_notes_xen` | Nassim-Asrir (@p1k4l4) | https://github.com/Nassim-Asrir/ZDI-24-020 | Technique credit; reimplemented in KASLD's own code. |
2424
| `prefetch` | Daniel Gruss et al. (technique); Will (timing asm) | https://gruss.cc/files/prefetch.pdf ; EntryBleed | Implements the published technique; adapts the EntryBleed timing asm. |
25+
| `arm64_tlb_fault_timing` | Milad Seddigh, Mahdi Esfahani, Sarani Bhattacharya, Mohammad Reza Aref, Hadi Soleimany | https://dl.acm.org/doi/10.1145/3560834.3563823 | Implements the published technique in KASLD's own code; no upstream code used. |
2526
| `zombieload` | ZombieLoad authors (Michael Schwarz, Moritz Lipp, et al., IAIK) | https://github.com/IAIK/ZombieLoad | Implements the published technique in KASLD's own code (`src/include/sidechannel.h`). |
2627

2728
Each component's full credit and reference URLs are in its file header under

0 commit comments

Comments
 (0)