All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Kees Cook <kees@kernel.org>
Cc: Jinjie Ruan <ruanjinjie@huawei.com>,
	catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com,
	luto@amacapital.net, wad@chromium.org, peterz@infradead.org,
	ada.coupriediaz@arm.com, linusw@kernel.org, yeoreum.yun@arm.com,
	kevin.brodsky@arm.com, anshuman.khandual@arm.com,
	james.morse@arm.com, thuth@redhat.com, vladimir.murzin@arm.com,
	tglx@kernel.org, broonie@kernel.org, liqiang01@kylinos.cn,
	ryan.roberts@arm.com, pengcan@kylinos.cn, kmehltretter@gmail.com,
	linux-arm-kernel@lists.infradead.org,
	Shuah Khan <shuah@kernel.org>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] selftests/ptrace: Add PTRACE_SYSEMU_SINGLESTEP syscall-exit-stop test
Date: Wed, 23 Sep 2026 13:07:09 +0200	[thread overview]
Message-ID: <arOy3YSkb9417Fo_@redhat.com> (raw)
In-Reply-To: <20260922195719.i.211-kees@kernel.org>

On 09/22, Kees Cook wrote:
>
> ptrace(2) states that no syscall-exit-stop occurs when a tracee is
> continued with PTRACE_SYSEMU or PTRACE_SYSEMU_SINGLESTEP. arm64 gated
> its syscall-exit report on
>
> 	flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)
>
> and ptrace_resume() clears SYSCALL_TRACE for both SYSEMU requests while
> PTRACE_SYSEMU_SINGLESTEP additionally sets TIF_SINGLESTEP, so the
> single-step bit alone produced a stop that must not exist. Nothing in
> tools/testing/selftests covered this.

IOW, this test-case veirifies that in the sequence like the generic code

	step = report_single_step(work);
	if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
		arch_ptrace_report_syscall_exit(regs, step);

report_single_step() returns false, right? SYSCALL_TRACE is cleared by
the arch neutral code...

> Link: https://lore.kernel.org/all/20260922035510.1090299-2-ruanjinjie@huawei.com/ [1]
> Assisted-by: LLM
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
>  tools/testing/selftests/ptrace/Makefile       |   3 +-
>  .../selftests/ptrace/sysemu_singlestep.c      | 176 ++++++++++++++++++
>  tools/testing/selftests/ptrace/.gitignore     |   1 +
>  3 files changed, 179 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/ptrace/sysemu_singlestep.c

Reviewed-by: Oleg Nesterov <oleg@redhat.com>


WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Kees Cook <kees@kernel.org>
Cc: mark.rutland@arm.com, peterz@infradead.org,
	catalin.marinas@arm.com, linux-hardening@vger.kernel.org,
	linux-kselftest@vger.kernel.org, will@kernel.org,
	Shuah Khan <shuah@kernel.org>,
	Jinjie Ruan <ruanjinjie@huawei.com>,
	thuth@redhat.com, vladimir.murzin@arm.com, ryan.roberts@arm.com,
	anshuman.khandual@arm.com, kevin.brodsky@arm.com,
	kmehltretter@gmail.com, pengcan@kylinos.cn, broonie@kernel.org,
	linux-arm-kernel@lists.infradead.org, wad@chromium.org,
	linusw@kernel.org, linux-kernel@vger.kernel.org,
	luto@amacapital.net, james.morse@arm.com, tglx@kernel.org,
	liqiang01@kylinos.cn, yeoreum.yun@arm.com
Subject: Re: [PATCH] selftests/ptrace: Add PTRACE_SYSEMU_SINGLESTEP syscall-exit-stop test
Date: Wed, 23 Sep 2026 13:07:09 +0200	[thread overview]
Message-ID: <arOy3YSkb9417Fo_@redhat.com> (raw)
In-Reply-To: <20260922195719.i.211-kees@kernel.org>

On 09/22, Kees Cook wrote:
>
> ptrace(2) states that no syscall-exit-stop occurs when a tracee is
> continued with PTRACE_SYSEMU or PTRACE_SYSEMU_SINGLESTEP. arm64 gated
> its syscall-exit report on
>
> 	flags & (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP)
>
> and ptrace_resume() clears SYSCALL_TRACE for both SYSEMU requests while
> PTRACE_SYSEMU_SINGLESTEP additionally sets TIF_SINGLESTEP, so the
> single-step bit alone produced a stop that must not exist. Nothing in
> tools/testing/selftests covered this.

IOW, this test-case veirifies that in the sequence like the generic code

	step = report_single_step(work);
	if (step || work & SYSCALL_WORK_SYSCALL_TRACE)
		arch_ptrace_report_syscall_exit(regs, step);

report_single_step() returns false, right? SYSCALL_TRACE is cleared by
the arch neutral code...

> Link: https://lore.kernel.org/all/20260922035510.1090299-2-ruanjinjie@huawei.com/ [1]
> Assisted-by: LLM
> Signed-off-by: Kees Cook <kees@kernel.org>
> ---
>  tools/testing/selftests/ptrace/Makefile       |   3 +-
>  .../selftests/ptrace/sysemu_singlestep.c      | 176 ++++++++++++++++++
>  tools/testing/selftests/ptrace/.gitignore     |   1 +
>  3 files changed, 179 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/ptrace/sysemu_singlestep.c

Reviewed-by: Oleg Nesterov <oleg@redhat.com>



  reply	other threads:[~2026-09-23 11:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 19:57 [PATCH] selftests/ptrace: Add PTRACE_SYSEMU_SINGLESTEP syscall-exit-stop test Kees Cook
2026-09-22 19:57 ` Kees Cook
2026-09-23 11:07 ` Oleg Nesterov [this message]
2026-09-23 11:07   ` Oleg Nesterov
2026-09-24  4:11 ` Jinjie Ruan
2026-09-24  4:11   ` Jinjie Ruan
2026-09-24 23:56   ` Kees Cook
2026-09-24 23:56     ` Kees Cook
2026-09-28  1:58     ` Jinjie Ruan
2026-09-28  1:58       ` Jinjie Ruan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=arOy3YSkb9417Fo_@redhat.com \
    --to=oleg@redhat.com \
    --cc=ada.coupriediaz@arm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=james.morse@arm.com \
    --cc=kees@kernel.org \
    --cc=kevin.brodsky@arm.com \
    --cc=kmehltretter@gmail.com \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liqiang01@kylinos.cn \
    --cc=luto@amacapital.net \
    --cc=mark.rutland@arm.com \
    --cc=pengcan@kylinos.cn \
    --cc=peterz@infradead.org \
    --cc=ruanjinjie@huawei.com \
    --cc=ryan.roberts@arm.com \
    --cc=shuah@kernel.org \
    --cc=tglx@kernel.org \
    --cc=thuth@redhat.com \
    --cc=vladimir.murzin@arm.com \
    --cc=wad@chromium.org \
    --cc=will@kernel.org \
    --cc=yeoreum.yun@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.