Re: [PATCH v5 10/13] powerpc/ptrace: split out ADV_DEBUG_REGS related functions.

From: Christophe Leroy
Date: Thu Mar 26 2020 - 08:53:44 EST




Le 24/03/2020 Ã 07:23, Michael Ellerman a ÃcritÂ:
Christophe Leroy <christophe.leroy@xxxxxx> writes:
On 03/20/2020 02:12 AM, Michael Ellerman wrote:
Christophe Leroy <christophe.leroy@xxxxxx> writes:
Move ADV_DEBUG_REGS functions out of ptrace.c, into
ptrace-adv.c and ptrace-noadv.c

Signed-off-by: Christophe Leroy <christophe.leroy@xxxxxx>
---
v4: Leave hw_breakpoint.h for ptrace.c
---
arch/powerpc/kernel/ptrace/Makefile | 4 +
arch/powerpc/kernel/ptrace/ptrace-adv.c | 468 ++++++++++++++++
arch/powerpc/kernel/ptrace/ptrace-decl.h | 5 +
arch/powerpc/kernel/ptrace/ptrace-noadv.c | 236 ++++++++
arch/powerpc/kernel/ptrace/ptrace.c | 650 ----------------------
5 files changed, 713 insertions(+), 650 deletions(-)
create mode 100644 arch/powerpc/kernel/ptrace/ptrace-adv.c
create mode 100644 arch/powerpc/kernel/ptrace/ptrace-noadv.c

This is somehow breaking the ptrace-hwbreak selftest on Power8:

test: ptrace-hwbreak
tags: git_version:v5.6-rc6-892-g7a285a6067d6
PTRACE_SET_DEBUGREG, WO, len: 1: Ok
PTRACE_SET_DEBUGREG, WO, len: 2: Ok
PTRACE_SET_DEBUGREG, WO, len: 4: Ok
PTRACE_SET_DEBUGREG, WO, len: 8: Ok
PTRACE_SET_DEBUGREG, RO, len: 1: Ok
PTRACE_SET_DEBUGREG, RO, len: 2: Ok
PTRACE_SET_DEBUGREG, RO, len: 4: Ok
PTRACE_SET_DEBUGREG, RO, len: 8: Ok
PTRACE_SET_DEBUGREG, RW, len: 1: Ok
PTRACE_SET_DEBUGREG, RW, len: 2: Ok
PTRACE_SET_DEBUGREG, RW, len: 4: Ok
PTRACE_SET_DEBUGREG, RW, len: 8: Ok
PPC_PTRACE_SETHWDEBUG, MODE_EXACT, WO, len: 1: Ok
PPC_PTRACE_SETHWDEBUG, MODE_EXACT, RO, len: 1: Ok
PPC_PTRACE_SETHWDEBUG, MODE_EXACT, RW, len: 1: Ok
PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW ALIGNED, WO, len: 6: Ok
PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW ALIGNED, RO, len: 6: Ok
PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW ALIGNED, RW, len: 6: Ok
PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED, WO, len: 6: Ok
PPC_PTRACE_SETHWDEBUG, MODE_RANGE, DW UNALIGNED, RO, len: 6: Fail
failure: ptrace-hwbreak

I haven't had time to work out why yet.


A (big) part of commit c3f68b0478e7 ("powerpc/watchpoint: Fix ptrace
code that muck around with address/len") was lost during rebase.

I'll send a fix, up to you to squash it in or commit it as is.

Thanks.


One person asked me if I sent the fix already. So yes, it is there:

https://patchwork.ozlabs.org/patch/1259348/

Christophe