Message ID | 20180517053715.24011-2-mikey@neuling.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 4f7c06e26ec9cf7fe9f0c54dc90079b6a4f4b2c3 |
Headers | show |
Series | [1/2] powerpc/ptrace: Fix enforcement of DAWR contraints | expand |
Michael Neuling <mikey@neuling.org> writes: > In this change: > e2a800beac 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. > > Signed-off-by: Michael Neuling <mikey@neuling.org> > Cc: stable@vger.kernel.org # 3.10+ If this is "fixing" e2a800beac then I think v3.11 is right for the stable tag? $ git describe --contains --long e2a800beaca1 v3.11-rc1~94^2~4 cheers
On Fri, 2018-05-18 at 22:56 +1000, Michael Ellerman wrote: > Michael Neuling <mikey@neuling.org> writes: > > In this change: > > e2a800beac 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. > > > > Signed-off-by: Michael Neuling <mikey@neuling.org> > > Cc: stable@vger.kernel.org # 3.10+ > > If this is "fixing" e2a800beac then I think v3.11 is right for the > stable tag? > > $ git describe --contains --long e2a800beaca1 > v3.11-rc1~94^2~4 You're right. I think read the output of gitk incorrectly. Thanks. Mikey
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index d23cf632ed..0f63dd5972 100644 --- a/arch/powerpc/kernel/ptrace.c +++ b/arch/powerpc/kernel/ptrace.c @@ -2443,6 +2443,7 @@ static int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, /* Create a new breakpoint request if one doesn't exist already */ hw_breakpoint_init(&attr); attr.bp_addr = hw_brk.address; + attr.bp_len = 8; arch_bp_generic_fields(hw_brk.type, &attr.bp_type);
In this change: e2a800beac 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. Signed-off-by: Michael Neuling <mikey@neuling.org> Cc: stable@vger.kernel.org # 3.10+ --- arch/powerpc/kernel/ptrace.c | 1 + 1 file changed, 1 insertion(+)