From: Abhishek Sagar <sagar.abhishek@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: jkenisto@us.ibm.com, ananth@in.ibm.com,
Masami Hiramatsu <mhiramat@redhat.com>,
Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 3/3] x86: WARN_ON breakpoints from .kprobes.text section
Date: Sun, 27 Jan 2008 14:39:35 +0530 [thread overview]
Message-ID: <479C4A4F.10604@gmail.com> (raw)
Identify breakpoints in .kprobes.text section. These certainly aren't kprobe traps. However, we make an exception for the breakpoint hardcoded into jprobe_return.
Signed-off-by: Abhishek Sagar <sagar.abhishek@gmail.com>
---
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 45f2949..f3d13d0 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -961,6 +961,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data)
{
struct die_args *args = data;
+ unsigned long addr = kprobe_bkpt_addr(args->regs);
int ret = NOTIFY_DONE;
if (args->regs && user_mode_vm(args->regs))
@@ -968,7 +969,14 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
switch (val) {
case DIE_INT3:
- if (kprobe_handler(args->regs))
+ if (in_kprobes_functions(addr) &&
+ !is_jprobe_bkpt((u8 *)addr)) {
+ /* A breakpoint has made it's way to the .kprobes.text
+ * section (excluding jprobe_return). This could be
+ * due to an external debugger. */
+ WARN_ON(1);
+
+ } else if (kprobe_handler(args->regs))
ret = NOTIFY_STOP;
break;
case DIE_DEBUG:
next reply other threads:[~2008-01-27 9:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-27 9:09 Abhishek Sagar [this message]
2008-01-27 14:28 ` [PATCH 3/3] x86: WARN_ON breakpoints from .kprobes.text section Masami Hiramatsu
2008-01-27 15:33 ` Abhishek Sagar
2008-01-27 22:08 ` Masami Hiramatsu
2008-01-28 11:16 ` Abhishek Sagar
2008-01-28 17:22 ` 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=479C4A4F.10604@gmail.com \
--to=sagar.abhishek@gmail.com \
--cc=ananth@in.ibm.com \
--cc=jkenisto@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
/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