Skip to content

Commit a877498

Browse files
mrutland-armAlex Shi
authored andcommitted
arm64: avoid TLB conflict with CONFIG_RANDOMIZE_BASE
When CONFIG_RANDOMIZE_BASE is selected, we modify the page tables to remap the kernel at a newly-chosen VA range. We do this with the MMU disabled, but do not invalidate TLBs prior to re-enabling the MMU with the new tables. Thus the old mappings entries may still live in TLBs, and we risk violating Break-Before-Make requirements, leading to TLB conflicts and/or other issues. We invalidate TLBs when we uninsall the idmap in early setup code, but prior to this we are subject to issues relating to the Break-Before-Make violation. Avoid these issues by invalidating the TLBs before the new mappings can be used by the hardware. Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR") Cc: <stable@vger.kernel.org> # 4.6+ Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Acked-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit fd363bd417ddb6103564c69cfcbd92d9a7877431) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 94fa0d8 commit a877498

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/arm64/kernel/head.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,9 @@ __enable_mmu:
697697
isb
698698
bl __create_page_tables // recreate kernel mapping
699699

700+
tlbi vmalle1 // Remove any stale TLB entries
701+
dsb nsh
702+
700703
msr sctlr_el1, x19 // re-enable the MMU
701704
isb
702705
ic iallu // flush instructions fetched

0 commit comments

Comments
 (0)