mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bradley Morgan <bradley.morgan@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>,
	Renzo Davoli <renzo@cs.unibo.it>
Cc: linux-kernel@vger.kernel.org, Oleg Nesterov <oleg@redhat.com>,
	"Dmitry V . Levin" <ldv@strace.io>,
	Alexey Gladkov <legion@kernel.org>,
	Eugene Syromyatnikov <evgsyr@gmail.com>,
	Charlie Jenkins <thecharlesjenkins@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	strace-devel@lists.strace.io, linux-api@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v4 2/2] selftests/ptrace: check that PTRACE_SET_SYSCALL_INFO rejects invalid error values
Date: Tue, 17 Nov 2026 15:46:19 +0000	[thread overview]
Message-ID: <7ABEC58C-5AAE-4FE2-9DBE-F068194A7406@linux.dev> (raw)
In-Reply-To: <20261116153642.a8dddc43f53fed0402283dfa@linux-foundation.org>

On 16 November 2026 23:36:42 GMT, Andrew Morton <akpm@linux-foundation.org>
wrote:
>On Mon, 16 Nov 2026 14:40:46 +0100 Renzo Davoli <renzo@cs.unibo.it> wrote:
>
>> At every exit stop of the set_syscall_info test, try to set with
>> is_error set a few values outside [-MAX_ERRNO, -1], check that
>> PTRACE_SET_SYSCALL_INFO fails with ERANGE and that the return value
>> of the system call is left untouched.
>
>Thanks.
>
>LLM suggested a little fixup here, please check.
>
>
>
>From: Andrew Morton <akpm@linux-foundation.org>
>Subject: selftests/ptrace: test the lowest valid syscall error
>Date: Mon, 16 Nov 2026 22:27:14 +0000
>
>PTRACE_SET_SYSCALL_INFO must reject values below -MAX_ERRNO while
>accepting -MAX_ERRNO itself. Name the bound locally for this userspace
>selftest, and add a successful exit-stop case at that boundary. Retain
>the existing -EISDIR case. The tracee checks the resulting errno.
>
>Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Reviewed-by: Bradley Morgan <bradley.morgan@linux.dev>

>Cc: Renzo Davoli <renzo@cs.unibo.it>
>
> tools/testing/selftests/ptrace/set_syscall_info.c |   25 +++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
>--- a/tools/testing/selftests/ptrace/set_syscall_info.c~selftests-ptrace-check-that-ptrace_set_syscall_info-rejects-invalid-error-values-fix
>+++ a/tools/testing/selftests/ptrace/set_syscall_info.c
>@@ -15,6 +15,8 @@
> #include <linux/types.h>
> #include <linux/ptrace.h>
> 
>+#define MAX_ERRNO 4095
>+
> #if defined(_MIPS_SIM) && _MIPS_SIM == _MIPS_SIM_NABI32
> /*
>  * MIPS N32 is the only architecture where __kernel_ulong_t
>@@ -131,7 +133,7 @@ static const long long bad_error_rval[]
> 	0,
> 	1,
> 	ESRCH,
>-	-4095 - 1,	/* -MAX_ERRNO - 1 */
>+	-MAX_ERRNO - 1,
> 	-2147483647LL - 1,
> #if __SIZEOF_LONG__ > 4
> 	0x100000000LL,
>@@ -325,6 +327,27 @@ TEST(set_syscall_info)
> 			}
> 		},
> 
>+		/* change scno, change non-error rval to -MAX_ERRNO */
>+		{
>+			{
>+				{
>+					__NR_chdir,
>+					{
>+						dummy[0], dummy[1], dummy[2],
>+						dummy[3], dummy[4], dummy[5]
>+					}
>+				}, {
>+					__NR_getppid,
>+					{
>+						dummy[0], dummy[1], dummy[2],
>+						dummy[3], dummy[4], dummy[5]
>+					}
>+				}
>+			}, {
>+				{ 0, tracer_pid }, { 1, -MAX_ERRNO }
>+			}
>+		},
>+
> 		/* change scno and all args, change non-error rval */
> 		{
> 			{
>_
>
>


--- Thanks!

      parent reply	other threads:[~2026-11-17 15:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 13:40 [PATCH v4 0/2] ptrace: reject out of range error values in PTRACE_SET_SYSCALL_INFO Renzo Davoli
2026-11-16 13:40 ` [PATCH v4 1/2] " Renzo Davoli
2026-11-16 14:03   ` Oleg Nesterov
2026-11-16 13:40 ` [PATCH v4 2/2] selftests/ptrace: check that PTRACE_SET_SYSCALL_INFO rejects invalid error values Renzo Davoli
2026-11-16 23:36   ` Andrew Morton
2026-11-17  9:05     ` Renzo Davoli
2026-11-17  9:51       ` Renzo Davoli
2026-11-17 15:46     ` Bradley Morgan [this message]

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=7ABEC58C-5AAE-4FE2-9DBE-F068194A7406@linux.dev \
    --to=bradley.morgan@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=evgsyr@gmail.com \
    --cc=ldv@strace.io \
    --cc=legion@kernel.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=renzo@cs.unibo.it \
    --cc=shuah@kernel.org \
    --cc=strace-devel@lists.strace.io \
    --cc=thecharlesjenkins@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®