Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136932
b: refs/heads/master
c: b180181
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Feb 20, 2009
1 parent 83459ca commit 4017a61
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b814d41f0987c7648d7ed07471258101c95c026b
refs/heads/master: b18018126f422f5b706fd750373425e10e84b486
6 changes: 1 addition & 5 deletions trunk/arch/x86/mm/fault.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,17 @@ static inline int kmmio_fault(struct pt_regs *regs, unsigned long addr)

static inline int notify_page_fault(struct pt_regs *regs)
{
#ifdef CONFIG_KPROBES
int ret = 0;

/* kprobe_running() needs smp_processor_id() */
if (!user_mode_vm(regs)) {
if (kprobes_built_in() && !user_mode_vm(regs)) {
preempt_disable();
if (kprobe_running() && kprobe_fault_handler(regs, 14))
ret = 1;
preempt_enable();
}

return ret;
#else
return 0;
#endif
}

/*
Expand Down
22 changes: 19 additions & 3 deletions trunk/include/linux/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ struct kprobe_blackpoint {
DECLARE_PER_CPU(struct kprobe *, current_kprobe);
DECLARE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);

/*
* For #ifdef avoidance:
*/
static inline int kprobes_built_in(void)
{
return 1;
}

#ifdef CONFIG_KRETPROBES
extern void arch_prepare_kretprobe(struct kretprobe_instance *ri,
struct pt_regs *regs);
Expand Down Expand Up @@ -271,8 +279,16 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
void kprobe_flush_task(struct task_struct *tk);
void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);

#else /* CONFIG_KPROBES */
#else /* !CONFIG_KPROBES: */

static inline int kprobes_built_in(void)
{
return 0;
}
static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
{
return 0;
}
static inline struct kprobe *get_kprobe(void *addr)
{
return NULL;
Expand Down Expand Up @@ -329,5 +345,5 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
static inline void kprobe_flush_task(struct task_struct *tk)
{
}
#endif /* CONFIG_KPROBES */
#endif /* _LINUX_KPROBES_H */
#endif /* CONFIG_KPROBES */
#endif /* _LINUX_KPROBES_H */

0 comments on commit 4017a61

Please sign in to comment.