Skip to content

Commit

Permalink
powerpc/hw_brk: Fix setting of length for exact mode breakpoints
Browse files Browse the repository at this point in the history
The smallest match region for both the DABR and DAWR is 8 bytes, so the
kernel needs to filter matches when users want to look at regions smaller than
this.

Currently we set the length of PPC_BREAKPOINT_MODE_EXACT breakpoints to 8.
This is wrong as in exact mode we should only match on 1 address, hence the
length should be 1.

This ensures that the kernel will filter out any exact mode hardware breakpoint
matches on any addresses other than the requested one.

Signed-off-by: Michael Neuling <[email protected]>
Reported-by: Edjunior Barbosa Machado <[email protected]>
Cc: [email protected]
Signed-off-by: Benjamin Herrenschmidt <[email protected]>
  • Loading branch information
mikey authored and ozbenh committed Jun 25, 2013
1 parent e7f345a commit b0b0aa9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,7 +1449,9 @@ static long ppc_set_hwdebug(struct task_struct *child,
*/
if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_RANGE_INCLUSIVE) {
len = bp_info->addr2 - bp_info->addr;
} else if (bp_info->addr_mode != PPC_BREAKPOINT_MODE_EXACT) {
} else if (bp_info->addr_mode == PPC_BREAKPOINT_MODE_EXACT)
len = 1;
else {
ptrace_put_breakpoints(child);
return -EINVAL;
}
Expand Down

0 comments on commit b0b0aa9

Please sign in to comment.