From: "tip-bot2 for Masami Hiramatsu" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] x86/kprobes: Restore BTF if the single-stepping is cancelled
Date: Wed, 09 Dec 2020 18:44:40 -0000 [thread overview]
Message-ID: <160753948030.3364.13136176345925305619.tip-bot2@tip-bot2> (raw)
In-Reply-To: <160389546985.106936.12727996109376240993.stgit@devnote2>
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 78ff2733ff352175eb7f4418a34654346e1b6cd2
Gitweb: https://git.kernel.org/tip/78ff2733ff352175eb7f4418a34654346e1b6cd2
Author: Masami Hiramatsu <mhiramat@kernel.org>
AuthorDate: Wed, 28 Oct 2020 23:31:10 +09:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 09 Dec 2020 17:08:57 +01:00
x86/kprobes: Restore BTF if the single-stepping is cancelled
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
---
arch/x86/kernel/kprobes/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 547c7ab..39f7d8c 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -937,6 +937,11 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
* So clear it by resetting the current kprobe:
*/
regs->flags &= ~X86_EFLAGS_TF;
+ /*
+ * Since the single step (trap) has been cancelled,
+ * we need to restore BTF here.
+ */
+ restore_btf();
/*
* If the TF flag was set before the kprobe hit,
next prev parent reply other threads:[~2020-12-09 18:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-27 9:15 [PATCH 0/3] x86/debug: Fixes Peter Zijlstra
2020-10-27 9:15 ` [PATCH 1/3] x86/debug: Fix BTF handling Peter Zijlstra
2020-10-27 19:41 ` Peter Zijlstra
2020-10-28 9:20 ` Masami Hiramatsu
2020-10-28 9:59 ` Peter Zijlstra
2020-10-28 12:11 ` Masami Hiramatsu
2020-10-28 14:31 ` [PATCH] x86/kprobes: Restore BTF if the single-stepping is cancelled Masami Hiramatsu
2020-12-07 23:22 ` Steven Rostedt
2020-12-09 18:44 ` tip-bot2 for Masami Hiramatsu [this message]
2020-10-27 22:19 ` [tip: x86/urgent] x86/debug: Fix BTF handling tip-bot2 for Peter Zijlstra
2020-10-27 9:15 ` [PATCH 2/3] x86/debug: Only clear/set ->virtual_dr6 for userspace #DB Peter Zijlstra
2020-10-27 22:19 ` [tip: x86/urgent] " tip-bot2 for Peter Zijlstra
2020-10-27 9:15 ` [PATCH 3/3] x86/debug: Fix PTRACE_{BLOCK,SINGLE}STEP vs ptrace_get_debugreg(6) Peter Zijlstra
2020-10-27 17:22 ` Kyle Huey
2020-10-27 18:33 ` [PATCH v2 3/3] Fix DR_STEP " Peter Zijlstra
2020-10-27 22:19 ` [tip: x86/urgent] x86/debug: " tip-bot2 for Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=160753948030.3364.13136176345925305619.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®