Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arm64: SW PAN: Point saved ttbr0 at the zero page when switching to i…
…nit_mm update_saved_ttbr0 mandates that mm->pgd is not swapper, since swapper contains kernel mappings and should never be installed into ttbr0. However, this means that callers must avoid passing the init_mm to update_saved_ttbr0 which in turn can cause the saved ttbr0 value to be out-of-date in the context of the idle thread. For example, EFI runtime services may leave the saved ttbr0 pointing at the EFI page table, and kernel threads may end up with stale references to freed page tables. This patch changes update_saved_ttbr0 so that the init_mm points the saved ttbr0 value to the empty zero page, which always exists and never contains valid translations. EFI and switch can then call into update_saved_ttbr0 unconditionally. Cc: Mark Rutland <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Vinayak Menon <[email protected]> Cc: <[email protected]> Fixes: 39bc88e ("arm64: Disable TTBR0_EL1 during normal kernel execution") Reviewed-by: Catalin Marinas <[email protected]> Reviewed-by: Mark Rutland <[email protected]> Reported-by: Vinayak Menon <[email protected]> Signed-off-by: Will Deacon <[email protected]>
- Loading branch information