All of lore.kernel.org
 help / color / mirror / Atom feed
From: "bibo,mao" <bibo.mao@intel.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	"Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>,
	Prasanna S Panchamukhi <prasanna@in.ibm.com>,
	hiramatu@sdl.hitachi.co.jp
Subject: [PATCH]kprobe handler discard user space trap
Date: Tue, 28 Feb 2006 15:23:12 +0800	[thread overview]
Message-ID: <4403FA60.6060701@intel.com> (raw)

Currently kprobe handler traps only happen in kernel space, so function
kprobe_exceptions_notify should skip traps which happen in user space.
This patch modifies this, and it is based on 2.6.16-rc4.

Signed-off-by: bibo mao <bibo.mao@intel.com>

diff -Nruap a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
--- a/arch/i386/kernel/kprobes.c    2006-02-25 17:08:52.000000000 +0800
+++ b/arch/i386/kernel/kprobes.c    2006-03-01 10:37:50.000000000 +0800
@@ -463,6 +463,9 @@ int __kprobes kprobe_exceptions_notify(s
      struct die_args *args = (struct die_args *)data;
      int ret = NOTIFY_DONE;

+    if (user_mode(args->regs))
+        return ret;
+
      switch (val) {
      case DIE_INT3:
          if (kprobe_handler(args->regs))
diff -Nruap a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
--- a/arch/ia64/kernel/kprobes.c    2006-02-25 17:08:53.000000000 +0800
+++ b/arch/ia64/kernel/kprobes.c    2006-03-01 10:39:15.000000000 +0800
@@ -740,6 +740,9 @@ int __kprobes kprobe_exceptions_notify(s
      struct die_args *args = (struct die_args *)data;
      int ret = NOTIFY_DONE;

+    if (user_mode(args->regs))
+        return ret;
+
      switch(val) {
      case DIE_BREAK:
          /* err is break number from ia64_bad_break() */
diff -Nruap a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
--- a/arch/powerpc/kernel/kprobes.c    2006-02-25 17:08:52.000000000 +0800
+++ b/arch/powerpc/kernel/kprobes.c    2006-03-01 10:39:53.000000000 +0800
@@ -397,6 +397,9 @@ int __kprobes kprobe_exceptions_notify(s
      struct die_args *args = (struct die_args *)data;
      int ret = NOTIFY_DONE;

+    if (user_mode(args->regs))
+        return ret;
+
      switch (val) {
      case DIE_BPT:
          if (kprobe_handler(args->regs))
diff -Nruap a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
--- a/arch/sparc64/kernel/kprobes.c    2006-02-25 17:08:52.000000000 +0800
+++ b/arch/sparc64/kernel/kprobes.c    2006-03-01 10:40:16.000000000 +0800
@@ -324,6 +324,9 @@ int __kprobes kprobe_exceptions_notify(s
      struct die_args *args = (struct die_args *)data;
      int ret = NOTIFY_DONE;

+    if (user_mode(args->regs))
+        return ret;
+
      switch (val) {
      case DIE_DEBUG:
          if (kprobe_handler(args->regs))
diff -Nruap a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
--- a/arch/x86_64/kernel/kprobes.c    2006-02-25 17:08:52.000000000 +0800
+++ b/arch/x86_64/kernel/kprobes.c    2006-03-01 10:38:48.000000000 +0800
@@ -601,6 +601,9 @@ int __kprobes kprobe_exceptions_notify(s
      struct die_args *args = (struct die_args *)data;
      int ret = NOTIFY_DONE;

+    if (user_mode(args->regs))
+        return ret;
+
      switch (val) {
      case DIE_INT3:
          if (kprobe_handler(args->regs))


             reply	other threads:[~2006-02-28  7:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-28  7:23 bibo,mao [this message]
2006-02-28 11:34 ` [PATCH]kprobe handler discard user space trap Prasanna S Panchamukhi
2006-03-01  6:23   ` bibo mao
  -- strict thread matches above, loose matches on Subject: below --
2006-03-02  6:36 Zhang, Yanmin

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=4403FA60.6060701@intel.com \
    --to=bibo.mao@intel.com \
    --cc=akpm@osdl.org \
    --cc=ananth@in.ibm.com \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=hiramatu@sdl.hitachi.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.