LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@kernel.org>
Cc: x86@kernel.org, Masami Hiramatsu <mhiramat@kernel.org>,
Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>,
linux-kernel@vger.kernel.org,
Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Laura Abbott <labbott@redhat.com>, Josef Bacik <jbacik@fb.com>,
Alexei Starovoitov <ast@kernel.org>,
Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Subject: [PATCH -tip v3 5/7] x86: kprobes: Ignore break_handler
Date: Thu, 17 May 2018 08:59:04 +0900 [thread overview]
Message-ID: <152651514451.25583.15475048007255467863.stgit@devbox> (raw)
In-Reply-To: <152651499561.25583.14488389770693278906.stgit@devbox>
Remove break_handler related code since that was used
only for jprobe and jprobe is removed now.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
arch/x86/kernel/kprobes/common.h | 10 ----------
arch/x86/kernel/kprobes/core.c | 13 ++-----------
arch/x86/kernel/kprobes/ftrace.c | 16 ++--------------
3 files changed, 4 insertions(+), 35 deletions(-)
diff --git a/arch/x86/kernel/kprobes/common.h b/arch/x86/kernel/kprobes/common.h
index ae38dccf0c8f..2b949f4fd4d8 100644
--- a/arch/x86/kernel/kprobes/common.h
+++ b/arch/x86/kernel/kprobes/common.h
@@ -105,14 +105,4 @@ static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsig
}
#endif
-#ifdef CONFIG_KPROBES_ON_FTRACE
-extern int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
- struct kprobe_ctlblk *kcb);
-#else
-static inline int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
- struct kprobe_ctlblk *kcb)
-{
- return 0;
-}
-#endif
#endif
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 7d4b8e870635..4badf22bb11f 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -690,10 +690,8 @@ int kprobe_int3_handler(struct pt_regs *regs)
/*
* If we have no pre-handler or it returned 0, we
* continue with normal processing. If we have a
- * pre-handler and it returned non-zero, it prepped
- * for calling the break_handler below on re-entry
- * for jprobe processing, so get out doing nothing
- * more here.
+ * pre-handler and it returned non-zero, it modified
+ * regs->ip so no singlestep is needed.
*/
if (!p->pre_handler || !p->pre_handler(p, regs))
setup_singlestep(p, regs, kcb, 0);
@@ -712,13 +710,6 @@ int kprobe_int3_handler(struct pt_regs *regs)
regs->ip = (unsigned long)addr;
preempt_enable_no_resched();
return 1;
- } else if (kprobe_running()) {
- p = __this_cpu_read(current_kprobe);
- if (p->break_handler && p->break_handler(p, regs)) {
- if (!skip_singlestep(p, regs, kcb))
- setup_singlestep(p, regs, kcb, 0);
- return 1;
- }
} /* else: not a kprobe fault; let the kernel handle it */
preempt_enable_no_resched();
diff --git a/arch/x86/kernel/kprobes/ftrace.c b/arch/x86/kernel/kprobes/ftrace.c
index 8dc0161cec8f..c8696f2a583f 100644
--- a/arch/x86/kernel/kprobes/ftrace.c
+++ b/arch/x86/kernel/kprobes/ftrace.c
@@ -26,7 +26,7 @@
#include "common.h"
static nokprobe_inline
-void __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
+void skip_singlestep(struct kprobe *p, struct pt_regs *regs,
struct kprobe_ctlblk *kcb, unsigned long orig_ip)
{
/*
@@ -43,18 +43,6 @@ void __skip_singlestep(struct kprobe *p, struct pt_regs *regs,
regs->ip = orig_ip;
}
-int skip_singlestep(struct kprobe *p, struct pt_regs *regs,
- struct kprobe_ctlblk *kcb)
-{
- if (kprobe_ftrace(p)) {
- __skip_singlestep(p, regs, kcb, 0);
- preempt_enable_no_resched();
- return 1;
- }
- return 0;
-}
-NOKPROBE_SYMBOL(skip_singlestep);
-
/* Ftrace callback handler for kprobes -- called under preepmt disabed */
void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *ops, struct pt_regs *regs)
@@ -80,7 +68,7 @@ void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
__this_cpu_write(current_kprobe, p);
kcb->kprobe_status = KPROBE_HIT_ACTIVE;
if (!p->pre_handler || !p->pre_handler(p, regs)) {
- __skip_singlestep(p, regs, kcb, orig_ip);
+ skip_singlestep(p, regs, kcb, orig_ip);
preempt_enable_no_resched();
}
/*
next prev parent reply other threads:[~2018-05-16 23:59 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-16 23:56 [PATCH -tip v3 0/7] kprobes: x86: Cleanup jprobe implementation on x86 Masami Hiramatsu
2018-05-16 23:57 ` [PATCH -tip v3 1/7] Documentation/kprobes: Fix to remove remaining jprobe Masami Hiramatsu
2018-05-16 23:57 ` [PATCH -tip v3 2/7] kprobes: Remove jprobe API implementation Masami Hiramatsu
2018-05-16 23:58 ` [PATCH -tip v3 3/7] x86: kprobes: Remove jprobe implementation Masami Hiramatsu
2018-05-16 23:58 ` [PATCH -tip v3 4/7] kprobes: Ignore break_handler Masami Hiramatsu
2018-05-18 6:16 ` Ingo Molnar
2018-05-18 13:38 ` Masami Hiramatsu
2018-05-18 6:20 ` Ingo Molnar
2018-05-18 14:14 ` Masami Hiramatsu
2018-05-16 23:59 ` Masami Hiramatsu [this message]
2018-05-18 6:26 ` [PATCH -tip v3 5/7] x86: " Ingo Molnar
2018-05-18 13:42 ` Masami Hiramatsu
2018-05-16 23:59 ` [PATCH -tip v3 6/7] bpf: error-inject: x86: Fix unbalanced preempt-count for function override Masami Hiramatsu
2018-05-17 0:00 ` [PATCH -tip v3 7/7] x86: kprobes: Do not disable preempt on int3 path Masami Hiramatsu
2018-05-18 6:23 ` [PATCH -tip v3 0/7] kprobes: x86: Cleanup jprobe implementation on x86 Ingo Molnar
2018-05-18 14:10 ` Masami Hiramatsu
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=152651514451.25583.15475048007255467863.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ananth@linux.vnet.ibm.com \
--cc=ast@kernel.org \
--cc=hpa@zytor.com \
--cc=jbacik@fb.com \
--cc=labbott@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=ravi.bangoria@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--subject='Re: [PATCH -tip v3 5/7] x86: kprobes: Ignore break_handler' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).