Skip to content

Commit c12d241

Browse files
mikeygregkh
authored andcommitted
powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG
commit 4f7c06e upstream. In commit e2a800b ("powerpc/hw_brk: Fix off by one error when validating DAWR region end") we fixed setting the DAWR end point to its max value via PPC_PTRACE_SETHWDEBUG. Unfortunately we broke PTRACE_SET_DEBUGREG when setting a 512 byte aligned breakpoint. PTRACE_SET_DEBUGREG currently sets the length of the breakpoint to zero (memset() in hw_breakpoint_init()). This worked with arch_validate_hwbkpt_settings() before the above patch was applied but is now broken if the breakpoint is 512byte aligned. This sets the length of the breakpoint to 8 bytes when using PTRACE_SET_DEBUGREG. Fixes: e2a800b ("powerpc/hw_brk: Fix off by one error when validating DAWR region end") Cc: [email protected] # v3.11+ Signed-off-by: Michael Neuling <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5fefd9a commit c12d241

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/powerpc/kernel/ptrace.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,6 +2362,7 @@ static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
23622362
/* Create a new breakpoint request if one doesn't exist already */
23632363
hw_breakpoint_init(&attr);
23642364
attr.bp_addr = hw_brk.address;
2365+
attr.bp_len = 8;
23652366
arch_bp_generic_fields(hw_brk.type,
23662367
&attr.bp_type);
23672368

0 commit comments

Comments
 (0)