]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG
authorMichael Neuling <mikey@neuling.org>
Thu, 17 May 2018 05:37:15 +0000 (15:37 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 21 May 2018 04:48:01 +0000 (14:48 +1000)
commitdc9b904eb40088070dce691ee43f4ab8c310e7c5
tree02148d5f4666597cc1f7911c87ab61f3fc0b2337
parent3ee0c2c215b88b63b065f3e4b3a30af460e34d69
powerpc/ptrace: Fix setting 512B aligned breakpoints with PTRACE_SET_DEBUGREG

In commit a9cb6e055f27 ("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: a9cb6e055f27 ("powerpc/hw_brk: Fix off by one error when validating DAWR region end")
Cc: stable@vger.kernel.org # v3.11+
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/ptrace.c