[PATCH 0/3] arm64: ptrace: Fix two old bugs

Jinjie Ruan ruanjinjie at huawei.com
Thu Nov 26 00:05:11 PST 2026


As Linus suggested, extract the two ptrace bugfix patch and related
selftests from the patch set of the generic entry patchset[1].

The bugfix were found when switching from arm64 to generic entry, the
fixes are simple but there are many selftests:

- Drop redundancy spurious pseudo-single-step for
  PTRACE_SYSEMU_SINGLESTEP.

- Check whether the syscall is in rseq critical section before
  reporting syscall exit.

- Add related selftests. Because there are currently two related bug
  fixes from long ago that lack self testcases, which are commit ac2081cdc4d99
  ("arm64: ptrace: Consistently use pseudo-singlestep exceptions") and
  commit 3a5a4366cecc ("arm64: ptrace: Override SPSR.SS when
  single-stepping is enabled")

Very welcome any discussion and feedback.

Changes in v1:
- Rebased on v7.4-rc3
- Add real hardware test in commit message.
- Fix selftest AI review issues [2].

[1]: https://lore.kernel.org/all/20261111114225.3977243-1-ruanjinjie@huawei.com/
[2]: https://sashiko.dev/#/patchset/20261111114225.3977243-1-ruanjinjie%40huawei.com

Jinjie Ruan (3):
  arm64: ptrace: Fix spurious pseudo-single-step for
    PTRACE_SYSEMU_SINGLESTEP
  arm64: ptrace: Check rseq critical section before reporting syscall
    exit
  selftests/arm64: Add ptrace single-step and rseq syscall-exit tests

 arch/arm64/kernel/ptrace.c                    |  16 +-
 tools/testing/selftests/arm64/Makefile        |   2 +-
 .../testing/selftests/arm64/ptrace/.gitignore |   6 +
 tools/testing/selftests/arm64/ptrace/Makefile |  15 ++
 .../selftests/arm64/ptrace/ptrace_common.h    | 159 ++++++++++++++
 .../selftests/arm64/ptrace/rseq_syscall_pc.c  | 197 ++++++++++++++++++
 .../selftests/arm64/ptrace/rseq_syscall_pc.h  |  22 ++
 .../arm64/ptrace/rseq_syscall_pc_asm.S        |  45 ++++
 .../arm64/ptrace/single_step_signal_handler.c | 121 +++++++++++
 .../arm64/ptrace/single_step_spsr_ss.c        |  79 +++++++
 .../arm64/ptrace/single_step_syscall_stop.c   | 103 +++++++++
 .../arm64/ptrace/sysemu_singlestep.c          | 141 +++++++++++++
 12 files changed, 902 insertions(+), 4 deletions(-)
 create mode 100644 tools/testing/selftests/arm64/ptrace/.gitignore
 create mode 100644 tools/testing/selftests/arm64/ptrace/Makefile
 create mode 100644 tools/testing/selftests/arm64/ptrace/ptrace_common.h
 create mode 100644 tools/testing/selftests/arm64/ptrace/rseq_syscall_pc.c
 create mode 100644 tools/testing/selftests/arm64/ptrace/rseq_syscall_pc.h
 create mode 100644 tools/testing/selftests/arm64/ptrace/rseq_syscall_pc_asm.S
 create mode 100644 tools/testing/selftests/arm64/ptrace/single_step_signal_handler.c
 create mode 100644 tools/testing/selftests/arm64/ptrace/single_step_spsr_ss.c
 create mode 100644 tools/testing/selftests/arm64/ptrace/single_step_syscall_stop.c
 create mode 100644 tools/testing/selftests/arm64/ptrace/sysemu_singlestep.c

-- 
2.34.1




More information about the linux-arm-kernel mailing list