mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: krisman@collabora.com, tglx@linutronix.de, luto@kernel.org,
	peterz@infradead.org, keescook@chromium.org,
	gregory.price@memverge.com, Marco Elver <elver@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] selftests: Extend syscall_user_dispatch test to check allowed range
Date: Mon, 3 Mar 2025 10:57:42 -0500	[thread overview]
Message-ID: <Z8XRdougwM_Wx76A@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <CACT4Y+btS62MDJLRToydRfK-QAMBiihv9d7Du=zEf5U_GbiOMg@mail.gmail.com>

On Mon, Feb 24, 2025 at 09:48:19AM +0100, Dmitry Vyukov wrote:
> On Thu, 20 Feb 2025 at 16:17, Gregory Price <gourry@gourry.net> wrote:
> >
> > On Tue, Feb 18, 2025 at 05:04:36PM +0100, Dmitry Vyukov wrote:
> > > diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_test.c b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
> > > index b0969925ec64c..fa40e46e6d3e9 100644
> > > --- a/tools/testing/selftests/syscall_user_dispatch/sud_test.c
> > > +++ b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
> > ... snip ...
> > > @@ -110,31 +111,15 @@ TEST(bad_prctl_param)
> > >       /* PR_SYS_DISPATCH_ON */
> > >       op = PR_SYS_DISPATCH_ON;
> > >
> > > -     /* Dispatcher region is bad (offset > 0 && len == 0) */
> > > -     EXPECT_EQ(-1, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x1, 0x0, &sel));
> > > -     EXPECT_EQ(EINVAL, errno);
> > > -     EXPECT_EQ(-1, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, -1L, 0x0, &sel));
> > > -     EXPECT_EQ(EINVAL, errno);
> > > +     /* All ranges are allowed */
> > > +     EXPECT_EQ(0, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0x1, 0x0, &sel));
> > > +     EXPECT_EQ(0, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, -1L, 0x0, &sel));
> >
> > A 0 length is ambiguous and nonsensical in every other context, not sure
> > why you'd allow it here.
> 
> Yes, but it's also not special in any way. One asks for a range of N
> bytes, one gets a range of N bytes.

It's specialy in the sense that it's nonsensical :]

I don't know what the prevaling opinion here is, but it seems pretty
obvious that a 0-length is almost certainly a mistake and reasonbly
should result in an EINVAL.

I don't feel strongly about this though.

~Gregory

      reply	other threads:[~2025-03-03 15:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1739894594.git.dvyukov@google.com>
2025-02-18 16:04 ` [PATCH 1/3] syscall_user_dispatch: Allow allowed range wrap-around Dmitry Vyukov
2025-02-18 16:58   ` Gregory Price
2025-02-18 17:34     ` Dmitry Vyukov
2025-02-18 18:00       ` Gregory Price
2025-02-19  8:54         ` Dmitry Vyukov
2025-02-19 13:29           ` Gregory Price
2025-02-18 16:04 ` [PATCH 2/3] selftests: Fix errno checking in syscall_user_dispatch test Dmitry Vyukov
2025-02-19 17:19   ` Kees Cook
2025-02-18 16:04 ` [PATCH 3/3] selftests: Extend syscall_user_dispatch test to check allowed range Dmitry Vyukov
2025-02-20 15:17   ` Gregory Price
2025-02-24  8:48     ` Dmitry Vyukov
2025-03-03 15:57       ` Gregory Price [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=Z8XRdougwM_Wx76A@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=gregory.price@memverge.com \
    --cc=keescook@chromium.org \
    --cc=krisman@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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®