]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/watchpoint: Fix length calculation for unaligned target
authorRavi Bangoria <ravi.bangoria@linux.ibm.com>
Thu, 17 Oct 2019 09:31:59 +0000 (15:01 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 13 Nov 2019 05:58:03 +0000 (16:58 +1100)
commitc17de71aeb0b40955ddadb06a4e7a8c488309be5
tree4e2155005e5805bfa5c4074f9702a5634c973b1f
parent3a5efcd368695e85aa518a0dc8670b0aa2e9b5f8
powerpc/watchpoint: Fix length calculation for unaligned target

Watchpoint match range is always doubleword(8 bytes) aligned on
powerpc. If the given range is crossing doubleword boundary, we need
to increase the length such that next doubleword also get
covered. Ex,

          address   len = 6 bytes
                |=========.
   |------------v--|------v--------|
   | | | | | | | | | | | | | | | | |
   |---------------|---------------|
    <---8 bytes--->

In such case, current code configures hw as:
  start_addr = address & ~HW_BREAKPOINT_ALIGN
  len = 8 bytes

And thus read/write in last 4 bytes of the given range is ignored.
Fix this by including next doubleword in the length.

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20191017093204.7511-3-ravi.bangoria@linux.ibm.com
arch/powerpc/include/asm/hw_breakpoint.h
arch/powerpc/kernel/dawr.c
arch/powerpc/kernel/hw_breakpoint.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/ptrace.c