From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
Masami Hiramatsu <mhiramat@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Li Zefan <lizf@cn.fujitsu.com>, Ingo Molnar <mingo@elte.hu>,
Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 01/24] kprobes/x86: Call BUG() when reentering probe into KPROBES_HIT_SS
Date: Tue, 22 Sep 2009 21:37:59 +0200 [thread overview]
Message-ID: <1253648302-5771-2-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1253648302-5771-1-git-send-email-fweisbec@gmail.com>
From: Masami Hiramatsu <mhiramat@redhat.com>
Call BUG() when a probe have been hit on the way of kprobe processing
path, because that kind of probes are currently unrecoverable
(recovering it will cause an infinite loop and stack overflow).
The original code seems to assume that it's caused by an int3
which another subsystem inserted on out-of-line singlestep buffer if
the hitting probe is same as current probe. However, in that case,
int3-hitting-address is on the out-of-line buffer and should be
different from first (current) int3 address.
Thus, I decided to remove the code.
I also removes arch_disarm_kprobe() because it will involve other stuffs
in text_poke().
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
LKML-Reference: <20090827172258.8246.61889.stgit@localhost.localdomain>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
arch/x86/kernel/kprobes.c | 26 ++++++++++----------------
1 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index ecee3d2..e0fb615 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -482,22 +482,16 @@ static int __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
kcb->kprobe_status = KPROBE_REENTER;
break;
case KPROBE_HIT_SS:
- if (p == kprobe_running()) {
- regs->flags &= ~X86_EFLAGS_TF;
- regs->flags |= kcb->kprobe_saved_flags;
- return 0;
- } else {
- /* A probe has been hit in the codepath leading up
- * to, or just after, single-stepping of a probed
- * instruction. This entire codepath should strictly
- * reside in .kprobes.text section.
- * Raise a BUG or we'll continue in an endless
- * reentering loop and eventually a stack overflow.
- */
- arch_disarm_kprobe(p);
- dump_kprobe(p);
- BUG();
- }
+ /* A probe has been hit in the codepath leading up to, or just
+ * after, single-stepping of a probed instruction. This entire
+ * codepath should strictly reside in .kprobes.text section.
+ * Raise a BUG or we'll continue in an endless reentering loop
+ * and eventually a stack overflow.
+ */
+ printk(KERN_WARNING "Unrecoverable kprobe detected at %p.\n",
+ p->addr);
+ dump_kprobe(p);
+ BUG();
default:
/* impossible cases */
WARN_ON(1);
--
1.6.2.3
next prev parent reply other threads:[~2009-09-22 19:38 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-22 19:37 [GIT PULL] tracing/kprobes: Kprobes core/tracing/profiling updates Frederic Weisbecker
2009-09-22 19:37 ` Frederic Weisbecker [this message]
2009-09-22 19:38 ` [PATCH 02/24] kprobes/x86-64: Allow to reenter probe on post_handler Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 03/24] kprobes/x86: Fix to add __kprobes to in-kernel fault handing functions Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 04/24] kprobes: Fix to add __kprobes to notify_die Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 05/24] kprobes/x86-64: Fix to move common_interrupt to .kprobes.text Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 06/24] kprobes: Prohibit to probe native_get_debugreg Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 07/24] x86: Allow x86-32 instruction decoder selftest on x86-64 Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 08/24] x86: Remove unused config macros from instruction decoder selftest Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 09/24] x86: Add MMX support for instruction decoder Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 10/24] kprobes/x86-32: Move irq-exit functions to kprobes section Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 11/24] x86/ptrace: Fix regs_get_argument_nth() to add correct offset Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 12/24] tracing/kprobes: Fix probe offset to be unsigned Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 13/24] tracing/kprobes: Cleanup kprobe tracer code Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 14/24] tracing/kprobes: Add event profiling support Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 15/24] tracing/kprobes: Add argument name support Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 16/24] tracing/kprobes: Show event name in trace output Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 17/24] tracing/kprobes: Support custom subsystem for each kprobe event Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 18/24] tracing/kprobes: Fix trace_probe registration order Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 19/24] ftrace: Fix trace_add_event_call() to initialize list Frederic Weisbecker
2009-09-23 1:11 ` Li Zefan
2009-09-23 8:16 ` Masami Hiramatsu
2009-09-22 19:38 ` [PATCH 20/24] ftrace: Fix trace_remove_event_call() to lock trace_event_mutex Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 21/24] tracing/kprobes: Add probe handler dispatcher to support perf and ftrace concurrent use Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 22/24] tracing/kprobes: Fix profiling alignment for perf_counter buffer Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 23/24] tracing/kprobes: Disable kprobe events by default after creation Frederic Weisbecker
2009-09-22 19:38 ` [PATCH 24/24] kprobes: Prevent re-registration of the same kprobe Frederic Weisbecker
2009-09-23 10:52 ` [GIT PULL] tracing/kprobes: Kprobes core/tracing/profiling updates Ingo Molnar
2009-09-23 12:04 ` Frédéric Weisbecker
2009-09-23 16:42 ` Masami Hiramatsu
2009-09-23 21:24 ` Frederic Weisbecker
2009-09-23 21:46 ` Ingo Molnar
2009-09-23 22:13 ` Ingo Molnar
2009-09-23 22:23 ` Frederic Weisbecker
2009-09-24 0:06 ` 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=1253648302-5771-2-git-send-email-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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®