public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH]kprobe handler discard user space trap
@ 2006-02-27  1:18 bibo,mao
  0 siblings, 0 replies; only message in thread
From: bibo,mao @ 2006-02-27  1:18 UTC (permalink / raw)
  To: systemtap; +Cc: Keshavamurthy, Anil S, prasanna, Zhang, Yanmin

Hi,
Currently kprobe handler mainly is for trap happening in kernel space, 
and if it happens in user space, it need uprobe to handle it, that is 
future feature. So user BREAK trap happens in user space, kprobe just 
skips it. Here is the patch, any suggestion is welcome.

thanks
bibo,mao

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-02-25 18:02:15.000000000 +0800
@@ -465,7 +465,7 @@ int __kprobes kprobe_exceptions_notify(s

  	switch (val) {
  	case DIE_INT3:
-		if (kprobe_handler(args->regs))
+		if (!user_mode(args->regs) && kprobe_handler(args->regs))
  			ret = NOTIFY_STOP;
  		break;
  	case DIE_DEBUG:
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-02-28 08:53:49.000000000 +0800
@@ -743,7 +743,7 @@ int __kprobes kprobe_exceptions_notify(s
  	switch(val) {
  	case DIE_BREAK:
  		/* err is break number from ia64_bad_break() */
-		if (args->err == 0x80200 || args->err == 0x80300 || args->err == 0)
+		if (!user_mode(args->regs) && (args->err == 0x80200 || args->err == 
0x80300 || args->err == 0))
  			if (pre_kprobes_handler(args))
  				ret = NOTIFY_STOP;
  		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-02-28 08:54:53.000000000 +0800
@@ -399,7 +399,7 @@ int __kprobes kprobe_exceptions_notify(s

  	switch (val) {
  	case DIE_BPT:
-		if (kprobe_handler(args->regs))
+		if (!user_mode(args->regs) && kprobe_handler(args->regs))
  			ret = NOTIFY_STOP;
  		break;
  	case DIE_SSTEP:
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-02-28 08:54:23.000000000 +0800
@@ -326,7 +326,7 @@ int __kprobes kprobe_exceptions_notify(s

  	switch (val) {
  	case DIE_DEBUG:
-		if (kprobe_handler(args->regs))
+		if (!user_mode(args->regs) && kprobe_handler(args->regs))
  			ret = NOTIFY_STOP;
  		break;
  	case DIE_DEBUG_2:
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-02-25 18:02:33.000000000 +0800
@@ -603,7 +603,7 @@ int __kprobes kprobe_exceptions_notify(s

  	switch (val) {
  	case DIE_INT3:
-		if (kprobe_handler(args->regs))
+		if (!user_mode(args->regs) && kprobe_handler(args->regs))
  			ret = NOTIFY_STOP;
  		break;
  	case DIE_DEBUG:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-27  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-27  1:18 [PATCH]kprobe handler discard user space trap bibo,mao

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 read-only IMAP folder(s) and NNTP newsgroup(s).