x86/kprobes: Restore BTF if the single-stepping is cancelled
authorMasami Hiramatsu <mhiramat@kernel.org>
Wed, 28 Oct 2020 14:31:10 +0000 (23:31 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:45 +0000 (11:53 +0100)
commit50cf9c6ca2674459626a8e47c88b8229097b9221
tree8d312b5acba371cdb65d35b230a81ec7542ecfd6
parent2deeead49c7a6bc7e84f8792534eedb590b47ead
x86/kprobes: Restore BTF if the single-stepping is cancelled

[ Upstream commit 78ff2733ff352175eb7f4418a34654346e1b6cd2 ]

Fix to restore BTF if single-stepping causes a page fault and
it is cancelled.

Usually the BTF flag was restored when the single stepping is done
(in resume_execution()). However, if a page fault happens on the
single stepping instruction, the fault handler is invoked and
the single stepping is cancelled. Thus, the BTF flag is not
restored.

Fixes: 1ecc798c6764 ("x86: debugctlmsr kprobes")
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/160389546985.106936.12727996109376240993.stgit@devnote2
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/x86/kernel/kprobes/core.c