Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77452
b: refs/heads/master
c: 7969691
h: refs/heads/master
v: v3
  • Loading branch information
Nicolas Pitre authored and Russell King committed Jan 26, 2008
1 parent 7ccbd30 commit 47fdb42
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 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: 785d3cd286f0bf67d1bf692559b9ae5de12678f5
refs/heads/master: 796969104cab0d454dbc792ad0d12a4f365a8564
8 changes: 1 addition & 7 deletions trunk/arch/arm/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
#include <asm/traps.h>
#include <asm/cacheflush.h>

/*
* This undefined instruction must be unique and
* reserved solely for kprobes' use.
*/
#define KPROBE_BREAKPOINT_INSTRUCTION 0xe7f001f8

#define MIN_STACK_SIZE(addr) \
min((unsigned long)MAX_STACK_SIZE, \
(unsigned long)current_thread_info() + THREAD_START_SP - (addr))
Expand Down Expand Up @@ -206,7 +200,7 @@ void __kprobes kprobe_handler(struct pt_regs *regs)
}
}

static int kprobe_trap_handler(struct pt_regs *regs, unsigned int instr)
int kprobe_trap_handler(struct pt_regs *regs, unsigned int instr)
{
kprobe_handler(regs);
return 0;
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/kallsyms.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/kprobes.h>

#include <asm/atomic.h>
#include <asm/cacheflush.h>
Expand Down Expand Up @@ -313,6 +314,17 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
get_user(instr, (u32 __user *)pc);
}

#ifdef CONFIG_KPROBES
/*
* It is possible to have recursive kprobes, so we can't call
* the kprobe trap handler with the undef_lock held.
*/
if (instr == KPROBE_BREAKPOINT_INSTRUCTION && !user_mode(regs)) {
kprobe_trap_handler(regs, instr);
return;
}
#endif

spin_lock_irqsave(&undef_lock, flags);
list_for_each_entry(hook, &undef_hook, node) {
if ((instr & hook->instr_mask) == hook->instr_val &&
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/asm-arm/kprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#define MAX_INSN_SIZE 2
#define MAX_STACK_SIZE 64 /* 32 would probably be OK */

/*
* This undefined instruction must be unique and
* reserved solely for kprobes' use.
*/
#define KPROBE_BREAKPOINT_INSTRUCTION 0xe7f001f8

#define regs_return_value(regs) ((regs)->ARM_r0)
#define flush_insn_slot(p) do { } while (0)
#define kretprobe_blacklist_size 0
Expand Down Expand Up @@ -55,6 +61,7 @@ struct kprobe_ctlblk {

void arch_remove_kprobe(struct kprobe *);

int kprobe_trap_handler(struct pt_regs *regs, unsigned int instr);
int kprobe_fault_handler(struct pt_regs *regs, unsigned int fsr);
int kprobe_exceptions_notify(struct notifier_block *self,
unsigned long val, void *data);
Expand Down

0 comments on commit 47fdb42

Please sign in to comment.