Commit f2b3d856 authored by James Morse's avatar James Morse Committed by Will Deacon

arm64: kprobe: Always blacklist the KVM world-switch code

On systems with VHE the kernel and KVM's world-switch code run at the
same exception level. Code that is only used on a VHE system does not
need to be annotated as __hyp_text as it can reside anywhere in the
 kernel text.

__hyp_text was also used to prevent kprobes from patching breakpoint
instructions into this region, as this code runs at a different
exception level. While this is no longer true with VHE, KVM still
switches VBAR_EL1, meaning a kprobe's breakpoint executed in the
world-switch code will cause a hyp-panic.

Move the __hyp_text check in the kprobes blacklist so it applies on
VHE systems too, to cover the common code and guest enter/exit
assembly.

Fixes: 888b3c87 ("arm64: Treat all entry code as non-kprobe-able")
Reviewed-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent 8ea23593
...@@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr) ...@@ -478,13 +478,13 @@ bool arch_within_kprobe_blacklist(unsigned long addr)
addr < (unsigned long)__entry_text_end) || addr < (unsigned long)__entry_text_end) ||
(addr >= (unsigned long)__idmap_text_start && (addr >= (unsigned long)__idmap_text_start &&
addr < (unsigned long)__idmap_text_end) || addr < (unsigned long)__idmap_text_end) ||
(addr >= (unsigned long)__hyp_text_start &&
addr < (unsigned long)__hyp_text_end) ||
!!search_exception_tables(addr)) !!search_exception_tables(addr))
return true; return true;
if (!is_kernel_in_hyp_mode()) { if (!is_kernel_in_hyp_mode()) {
if ((addr >= (unsigned long)__hyp_text_start && if ((addr >= (unsigned long)__hyp_idmap_text_start &&
addr < (unsigned long)__hyp_text_end) ||
(addr >= (unsigned long)__hyp_idmap_text_start &&
addr < (unsigned long)__hyp_idmap_text_end)) addr < (unsigned long)__hyp_idmap_text_end))
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment