mbox series

[v3,0/7] arm64: Fix single-step handling and syscall tracing

Message ID 20200710130702.30658-1-will@kernel.org (mailing list archive)
Headers show
Series arm64: Fix single-step handling and syscall tracing | expand

Message

Will Deacon July 10, 2020, 1:06 p.m. UTC
Hi folks,

This is version three of the patches I previous posted here:

  v1: https://lore.kernel.org/r/20200603151033.11512-1-will@kernel.org
  v2: https://lore.kernel.org/r/20200702212618.17800-1-will@kernel.org

This version includes some changes I've been hacking on in relation to
syscall entry/exit, as it seemed worth lumping all this together. I've
also reordered the series to put the fixes at the start.

Luis -- did you manage to test v2? I'd quite like to queue some of this
soon. If you don't have time, how can I run the GDB testsuite myself? I
tried doing it a _long_ time ago but I remember there being a lot of
failures and flakey tests, so it wasn't very helpful. I have arm64
hardware running Debian so it's just a question of which buttons to
press :)

Cheers,

Will

Cc: <kernel-team@android.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Luis Machado <luis.machado@linaro.org>
Cc: Keno Fischer <keno@juliacomputing.com>
Cc: Kees Cook <keescook@chromium.org>

--->8

Will Deacon (7):
  arm64: ptrace: Consistently use pseudo-singlestep exceptions
  arm64: ptrace: Override SPSR.SS when single-stepping is enabled
  arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
  arm64: ptrace: Add a comment describing our syscall entry/exit trap
    ABI
  arm64: syscall: Expand the comment about ptrace and syscall(-1)
  arm64: ptrace: Use NO_SYSCALL instead of -1 in syscall_trace_enter()
  arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP

 arch/arm64/include/asm/debug-monitors.h |  2 +
 arch/arm64/include/asm/syscall.h        | 12 +++++-
 arch/arm64/include/asm/thread_info.h    |  1 +
 arch/arm64/kernel/debug-monitors.c      | 24 +++++++++---
 arch/arm64/kernel/ptrace.c              | 49 +++++++++++++++++++------
 arch/arm64/kernel/signal.c              | 11 +-----
 arch/arm64/kernel/syscall.c             | 21 ++++++++++-
 7 files changed, 90 insertions(+), 30 deletions(-)

Comments

Luis Machado July 14, 2020, 11:57 a.m. UTC | #1
Hi Will,

On 7/10/20 10:06 AM, Will Deacon wrote:
> Hi folks,
> 
> This is version three of the patches I previous posted here:
> 
>    v1: https://lore.kernel.org/r/20200603151033.11512-1-will@kernel.org
>    v2: https://lore.kernel.org/r/20200702212618.17800-1-will@kernel.org
> 
> This version includes some changes I've been hacking on in relation to
> syscall entry/exit, as it seemed worth lumping all this together. I've
> also reordered the series to put the fixes at the start.
> 
> Luis -- did you manage to test v2? I'd quite like to queue some of this
> soon. If you don't have time, how can I run the GDB testsuite myself? I
> tried doing it a _long_ time ago but I remember there being a lot of
> failures and flakey tests, so it wasn't very helpful. I have arm64
> hardware running Debian so it's just a question of which buttons to
> press :)

I didn't manage to test it yet. I was going to try v3 today.

If you have hardware though, that would be best. You just need to build 
GDB from sources (configure and make) and give the testsuite a try (make 
check-gdb). I can look at the result/summary and OK it.

There are still flakey tests unfortunately, but those shouldn't be a big 
problem.

You can ping me on IRC if you want to address any issues you have with 
building/running the tests.

I'll give it a try with QEMU anyway.

> 
> Cheers,
> 
> Will
> 
> Cc: <kernel-team@android.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Luis Machado <luis.machado@linaro.org>
> Cc: Keno Fischer <keno@juliacomputing.com>
> Cc: Kees Cook <keescook@chromium.org>
> 
> --->8
> 
> Will Deacon (7):
>    arm64: ptrace: Consistently use pseudo-singlestep exceptions
>    arm64: ptrace: Override SPSR.SS when single-stepping is enabled
>    arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
>    arm64: ptrace: Add a comment describing our syscall entry/exit trap
>      ABI
>    arm64: syscall: Expand the comment about ptrace and syscall(-1)
>    arm64: ptrace: Use NO_SYSCALL instead of -1 in syscall_trace_enter()
>    arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
> 
>   arch/arm64/include/asm/debug-monitors.h |  2 +
>   arch/arm64/include/asm/syscall.h        | 12 +++++-
>   arch/arm64/include/asm/thread_info.h    |  1 +
>   arch/arm64/kernel/debug-monitors.c      | 24 +++++++++---
>   arch/arm64/kernel/ptrace.c              | 49 +++++++++++++++++++------
>   arch/arm64/kernel/signal.c              | 11 +-----
>   arch/arm64/kernel/syscall.c             | 21 ++++++++++-
>   7 files changed, 90 insertions(+), 30 deletions(-)
>
Luis Machado July 15, 2020, 12:25 p.m. UTC | #2
Hi Will,

This looks good from GDB's side based on the testsuite results.

Thanks for fixing it.

Regards,
Luis

On 7/10/20 10:06 AM, Will Deacon wrote:
> Hi folks,
> 
> This is version three of the patches I previous posted here:
> 
>    v1: https://lore.kernel.org/r/20200603151033.11512-1-will@kernel.org
>    v2: https://lore.kernel.org/r/20200702212618.17800-1-will@kernel.org
> 
> This version includes some changes I've been hacking on in relation to
> syscall entry/exit, as it seemed worth lumping all this together. I've
> also reordered the series to put the fixes at the start.
> 
> Luis -- did you manage to test v2? I'd quite like to queue some of this
> soon. If you don't have time, how can I run the GDB testsuite myself? I
> tried doing it a _long_ time ago but I remember there being a lot of
> failures and flakey tests, so it wasn't very helpful. I have arm64
> hardware running Debian so it's just a question of which buttons to
> press :)
> 
> Cheers,
> 
> Will
> 
> Cc: <kernel-team@android.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Luis Machado <luis.machado@linaro.org>
> Cc: Keno Fischer <keno@juliacomputing.com>
> Cc: Kees Cook <keescook@chromium.org>
> 
> --->8
> 
> Will Deacon (7):
>    arm64: ptrace: Consistently use pseudo-singlestep exceptions
>    arm64: ptrace: Override SPSR.SS when single-stepping is enabled
>    arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
>    arm64: ptrace: Add a comment describing our syscall entry/exit trap
>      ABI
>    arm64: syscall: Expand the comment about ptrace and syscall(-1)
>    arm64: ptrace: Use NO_SYSCALL instead of -1 in syscall_trace_enter()
>    arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP
> 
>   arch/arm64/include/asm/debug-monitors.h |  2 +
>   arch/arm64/include/asm/syscall.h        | 12 +++++-
>   arch/arm64/include/asm/thread_info.h    |  1 +
>   arch/arm64/kernel/debug-monitors.c      | 24 +++++++++---
>   arch/arm64/kernel/ptrace.c              | 49 +++++++++++++++++++------
>   arch/arm64/kernel/signal.c              | 11 +-----
>   arch/arm64/kernel/syscall.c             | 21 ++++++++++-
>   7 files changed, 90 insertions(+), 30 deletions(-)
>