From: Thomas Gleixner <tglx@linutronix.de>
To: Dmitry Vyukov <dvyukov@google.com>,
krisman@collabora.com, luto@kernel.org, peterz@infradead.org,
keescook@chromium.org, gregory.price@memverge.com
Cc: Dmitry Vyukov <dvyukov@google.com>,
Marco Elver <elver@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] selftests: Fix errno checking in syscall_user_dispatch test
Date: Sat, 08 Mar 2025 13:34:34 +0100 [thread overview]
Message-ID: <87v7sj3dlx.ffs@tglx> (raw)
In-Reply-To: <d11d91e0c27ef78affcef06e00d1cf4cd8747fcc.1740386567.git.dvyukov@google.com>
On Mon, Feb 24 2025 at 09:45, Dmitry Vyukov wrote:
>
> Also use EXPECT/ASSERT consistently. Currently there is an inconsistent mix
> without obvious reasons for usage of one or another.
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
As Gregory said, this should be the first patch in the series with a
proper Fixes tag.
> /* Invalid op */
> op = -1;
> - prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0, 0, &sel);
> - ASSERT_EQ(EINVAL, errno);
> + EXPECT_EQ(-1, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, 0, 0, &sel));
> + EXPECT_EQ(EINVAL, errno);
Seriously?
Something like:
static void prctl_invalid(unsigned long op, unsigned long offs, unsigned long len,
void *sel, int err)
{
EXPECT_EQ(-1, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, offs, len, 0, (unsigned long)sel));
EXPECT_EQ(err, errno);
}
static void prctl_valid(unsigned long op, unsigned long offs, unsigned long len,
void *sel)
{
EXPECT_EQ(0, prctl(PR_SET_SYSCALL_USER_DISPATCH, op, offs, len, 0, (unsigned long)sel));
}
....
/* Invalid op */
prctl_invalid(-1, 0, 0, &sel, -EINVAL);
/* offset != 0 */
prctl_invalid(PR_SYS_DISPATCH_OFF, 1, 0, NULL, -EINVAL);
....
/* The odd valid test in bad_prctl_param() */
prctl_valid(PR_SYS_DISPATCH_OFF, 0, 0, NULL);
But that's not enough macro uglyness sprinkled all over the place and
too readable, right?
Thanks,
tglx
next prev parent reply other threads:[~2025-03-08 12:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1740386567.git.dvyukov@google.com>
2025-02-24 8:45 ` [PATCH v2 1/3] syscall_user_dispatch: Allow allowed range wrap-around Dmitry Vyukov
2025-03-08 10:00 ` Dmitry Vyukov
2025-03-08 11:19 ` Thomas Gleixner
2025-05-21 15:05 ` Dmitry Vyukov
2025-02-24 8:45 ` [PATCH v2 2/3] selftests: Fix errno checking in syscall_user_dispatch test Dmitry Vyukov
2025-03-03 16:06 ` Gregory Price
2025-03-08 9:57 ` Dmitry Vyukov
2025-03-08 12:34 ` Thomas Gleixner [this message]
2025-05-21 10:07 ` Dmitry Vyukov
2025-05-21 11:10 ` Thomas Weißschuh
2025-05-21 13:00 ` Dmitry Vyukov
2025-02-24 8:45 ` [PATCH v2 3/3] selftests: Extend syscall_user_dispatch test to check allowed range Dmitry Vyukov
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=87v7sj3dlx.ffs@tglx \
--to=tglx@linutronix.de \
--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 \
/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