This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]kprobe handler discard user space trap


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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]