diff options
author | Will Deacon <will.deacon@arm.com> | 2015-03-19 18:43:00 +0300 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-03-20 20:05:16 +0300 |
commit | 130c93fd10c4d150e39d8879420c1351aa207fa9 (patch) | |
tree | 6957d65f53549713852ce1f18af6c3600ec8c8a9 /lib/bch.c | |
parent | 06e5801b8cb3fc057d88cb4dc03c0b64b2744cda (diff) | |
download | linux-130c93fd10c4d150e39d8879420c1351aa207fa9.tar.xz |
arm64: efi: don't restore TTBR0 if active_mm points at init_mm
init_mm isn't a normal mm: it has swapper_pg_dir as its pgd (which
contains kernel mappings) and is used as the active_mm for the idle
thread.
When restoring the pgd after an EFI call, we write current->active_mm
into TTBR0. If the current task is actually the idle thread (e.g. when
initialising the EFI RTC before entering userspace), then the TLB can
erroneously populate itself with junk global entries as a result of
speculative table walks.
When we do eventually return to userspace, the task can end up hitting
these junk mappings leading to lockups, corruption or crashes.
This patch fixes the problem in the same way as the CPU suspend code by
ensuring that we never switch to the init_mm in efi_set_pgd and instead
point TTBR0 at the zero page. A check is also added to cpu_switch_mm to
BUG if we get passed swapper_pg_dir.
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: f3cdfd239da5 ("arm64/efi: move SetVirtualAddressMap() to UEFI stub")
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'lib/bch.c')
0 files changed, 0 insertions, 0 deletions