[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z8XRdougwM_Wx76A@gourry-fedora-PF4VCD3F>
Date: Mon, 3 Mar 2025 10:57:42 -0500
From: Gregory Price <gourry@...rry.net>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: krisman@...labora.com, tglx@...utronix.de, luto@...nel.org,
peterz@...radead.org, keescook@...omium.org,
gregory.price@...verge.com, Marco Elver <elver@...gle.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] selftests: Extend syscall_user_dispatch test to
check allowed range
On Mon, Feb 24, 2025 at 09:48:19AM +0100, Dmitry Vyukov wrote:
> On Thu, 20 Feb 2025 at 16:17, Gregory Price <gourry@...rry.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
Powered by blists - more mailing lists