Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204684
b: refs/heads/master
c: e3e9408
h: refs/heads/master
v: v3
  • Loading branch information
K.Prasad authored and Paul Mackerras committed Jun 22, 2010
1 parent 82a3bfe commit ddb2209
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 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: 06532a6743d83fac4b79389fc8c86c88cb4e3302
refs/heads/master: e3e94084adb5610987283367574ebc771e8206e1
1 change: 1 addition & 0 deletions trunk/arch/powerpc/include/asm/hw_breakpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#ifdef CONFIG_HAVE_HW_BREAKPOINT

struct arch_hw_breakpoint {
bool extraneous_interrupt;
u8 len; /* length of the target data symbol */
int type;
unsigned long address;
Expand Down
23 changes: 21 additions & 2 deletions trunk/arch/powerpc/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
int stepped = 1;
struct arch_hw_breakpoint *info;
unsigned int instr;
unsigned long dar = regs->dar;

/* Disable breakpoints during exception handling */
set_dabr(0);
Expand Down Expand Up @@ -234,6 +235,22 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
goto out;
}

/*
* Verify if dar lies within the address range occupied by the symbol
* being watched to filter extraneous exceptions.
*/
if (!((bp->attr.bp_addr <= dar) &&
(dar <= (bp->attr.bp_addr + bp->attr.bp_len)))) {
/*
* This exception is triggered not because of a memory access
* on the monitored variable but in the double-word address
* range in which it is contained. We will consume this
* exception, considering it as 'noise'.
*/
info->extraneous_interrupt = true;
} else
info->extraneous_interrupt = false;

/* Do not emulate user-space instructions, instead single-step them */
if (user_mode(regs)) {
bp->ctx->task->thread.last_hit_ubp = bp;
Expand Down Expand Up @@ -261,7 +278,8 @@ int __kprobes hw_breakpoint_handler(struct die_args *args)
* As a policy, the callback is invoked in a 'trigger-after-execute'
* fashion
*/
perf_bp_event(bp, regs);
if (!info->extraneous_interrupt)
perf_bp_event(bp, regs);

set_dabr(info->address | info->type | DABR_TRANSLATION);
out:
Expand Down Expand Up @@ -292,7 +310,8 @@ int __kprobes single_step_dabr_instruction(struct die_args *args)
* We shall invoke the user-defined callback function in the single
* stepping handler to confirm to 'trigger-after-execute' semantics
*/
perf_bp_event(bp, regs);
if (!bp_info->extraneous_interrupt)
perf_bp_event(bp, regs);

/*
* Do not disable MSR_SE if the process was already in
Expand Down

0 comments on commit ddb2209

Please sign in to comment.