From: "bibo,mao" 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 Cc: Ananth N Mavinakayanahalli Cc: "Keshavamurthy, Anil S" Cc: Cc: Prasanna S Panchamukhi Signed-off-by: Andrew Morton --- arch/i386/kernel/kprobes.c | 3 +++ arch/ia64/kernel/kprobes.c | 3 +++ arch/powerpc/kernel/kprobes.c | 3 +++ arch/sparc64/kernel/kprobes.c | 3 +++ arch/x86_64/kernel/kprobes.c | 3 +++ 5 files changed, 15 insertions(+) diff -puN arch/i386/kernel/kprobes.c~kprobe-handler-discard-user-space-trap arch/i386/kernel/kprobes.c --- devel/arch/i386/kernel/kprobes.c~kprobe-handler-discard-user-space-trap 2006-02-28 22:46:43.000000000 -0800 +++ devel-akpm/arch/i386/kernel/kprobes.c 2006-02-28 22:49:47.000000000 -0800 @@ -576,6 +576,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 -puN arch/ia64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap arch/ia64/kernel/kprobes.c --- devel/arch/ia64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap 2006-02-28 22:46:43.000000000 -0800 +++ devel-akpm/arch/ia64/kernel/kprobes.c 2006-02-28 22:46:43.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 -puN arch/powerpc/kernel/kprobes.c~kprobe-handler-discard-user-space-trap arch/powerpc/kernel/kprobes.c --- devel/arch/powerpc/kernel/kprobes.c~kprobe-handler-discard-user-space-trap 2006-02-28 22:46:43.000000000 -0800 +++ devel-akpm/arch/powerpc/kernel/kprobes.c 2006-02-28 22:46:43.000000000 -0800 @@ -396,6 +396,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 -puN arch/sparc64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap arch/sparc64/kernel/kprobes.c --- devel/arch/sparc64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap 2006-02-28 22:46:43.000000000 -0800 +++ devel-akpm/arch/sparc64/kernel/kprobes.c 2006-02-28 22:46:43.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 -puN arch/x86_64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap arch/x86_64/kernel/kprobes.c --- devel/arch/x86_64/kernel/kprobes.c~kprobe-handler-discard-user-space-trap 2006-02-28 22:46:43.000000000 -0800 +++ devel-akpm/arch/x86_64/kernel/kprobes.c 2006-02-28 22:46:43.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)) _