]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Move BP hardening to check_and_switch_context
authorMarc Zyngier <marc.zyngier@arm.com>
Fri, 19 Jan 2018 15:42:09 +0000 (15:42 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Tue, 23 Jan 2018 15:40:29 +0000 (15:40 +0000)
commit6cf79851d820d4f8edeb4cce2408509f5b3de6cb
tree018cd8a8a9d560355830d94407d33d96355bb5d9
parent5c9c1c262c96447854ee174f91b04949c605af24
arm64: Move BP hardening to check_and_switch_context

We call arm64_apply_bp_hardening() from post_ttbr_update_workaround,
which has the unexpected consequence of being triggered on every
exception return to userspace when ARM64_SW_TTBR0_PAN is selected,
even if no context switch actually occured.

This is a bit suboptimal, and it would be more logical to only
invalidate the branch predictor when we actually switch to
a different mm.

In order to solve this, move the call to arm64_apply_bp_hardening()
into check_and_switch_context(), where we're guaranteed to pick
a different mm context.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/mm/context.c