Messages in this thread | | | Date | Thu, 10 Jan 2008 00:16:21 +0100 | From | Heiko Carstens <> | Subject | Re: [PATCHv4] kprobes: Introduce kprobe_handle_fault() |
| |
> arch/avr32/mm/fault.c | 21 +-------------------- > arch/ia64/mm/fault.c | 24 +----------------------- > arch/powerpc/mm/fault.c | 25 +------------------------ > arch/s390/mm/fault.c | 25 +------------------------ > arch/sparc64/mm/fault.c | 23 +---------------------- > arch/x86/mm/fault_64.c | 23 ++--------------------- > include/linux/kprobes.h | 17 +++++++++++++++++ > 7 files changed, 24 insertions(+), 134 deletions(-)
Somehow I think you missed arch/x86/mm/fault_32.c :)
> This uncovered a possible bug in the s390 version as that purely > copied the x86 version unconditionally passing 14 as the trapnr > rather than the error_code parameter.
> diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c > index 2456b52..a9033cf 100644 > --- a/arch/s390/mm/fault.c > +++ b/arch/s390/mm/fault.c > @@ -51,29 +51,6 @@ extern int sysctl_userprocess_debug; > > extern void die(const char *,struct pt_regs *,long); > > -#ifdef CONFIG_KPROBES > -static inline int notify_page_fault(struct pt_regs *regs, long err) > -{ > - int ret = 0; > - > - /* kprobe_running() needs smp_processor_id() */ > - if (!user_mode(regs)) { > - preempt_disable(); > - if (kprobe_running() && kprobe_fault_handler(regs, 14)) > - ret = 1; > - preempt_enable(); > - } > - > - return ret; > -} > -#else > -static inline int notify_page_fault(struct pt_regs *regs, long err) > -{ > - return 0; > -} > -#endif > - > - > /* > * Unlock any spinlocks which will prevent us from getting the > * message out. > @@ -309,7 +286,7 @@ do_exception(struct pt_regs *regs, unsigned long error_code, int write) > int si_code; > int fault; > > - if (notify_page_fault(regs, error_code)) > + if (kprobe_handle_fault(regs, 14)) > return;
Uhm.. yes. 14 is HFP-Significance exception. That doesn't make too much sense. Passing error_code here would be the right thing to do. Also I just checked with David Wilder: system tap itself doesn't have any fault handlers. So it should be safe to change this.
| |