arm64: kprobes: Return DBG_HOOK_ERROR if kprobes can not handle a BRK
authorMasami Hiramatsu (Google) <mhiramat@kernel.org>
Fri, 2 Dec 2022 02:18:52 +0000 (11:18 +0900)
committerWill Deacon <will@kernel.org>
Mon, 5 Dec 2022 14:20:08 +0000 (14:20 +0000)
commit3b84efc066f8793a6581018d92da9b304abd8ce8
tree5de96836cae3b00671e450c18a4705f27d589c5e
parent30a421552373d2becb378282408a399702a0f00a
arm64: kprobes: Return DBG_HOOK_ERROR if kprobes can not handle a BRK

Return DBG_HOOK_ERROR if kprobes can not handle a BRK because it
fails to find a kprobe corresponding to the address.

Since arm64 kprobes uses stop_machine based text patching for removing
BRK, it ensures all running kprobe_break_handler() is done at that point.
And after removing the BRK, it removes the kprobe from its hash list.
Thus, if the kprobe_break_handler() fails to find kprobe from hash list,
there is a bug.

Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Link: https://lore.kernel.org/r/166994753273.439920.6629626290560350760.stgit@devnote3
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/probes/kprobes.c