From: Elizabeth Figura <zfigura@codeweavers.com>
To: "Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
Cc: wine-devel@winehq.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] selftests: ntsync: add wait argument validation tests
Date: Wed, 01 Jul 2026 11:38:35 -0500 [thread overview]
Message-ID: <4743910.LvFx2qVVIh@camazotz> (raw)
In-Reply-To: <20260628024239.152852-4-ivanrwcm25@gmail.com>
On Saturday, 27 June 2026 21:42:38 CDT Iván Ezequiel Rodriguez wrote:
> Add coverage for documented EINVAL cases: zero owner on wait any/all,
> non-zero pad, and objects from a different /dev/ntsync instance.
>
> Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
> ---
> .../testing/selftests/drivers/ntsync/ntsync.c | 44 +++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c
> index 12b4b81edf7f..c9fe4d5987ec 100644
> --- a/tools/testing/selftests/drivers/ntsync/ntsync.c
> +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c
> @@ -1340,4 +1340,48 @@ TEST(stress_wait)
> close(stress_device);
> }
>
> +TEST(wait_args_validation)
> +{
> + struct ntsync_sem_args sem_args = { .count = 1, .max = 1 };
> + struct ntsync_wait_args wait_args = {0};
> + struct timespec timeout;
> + int fd, fd2, sem, ret;
> + __u32 index;
> +
> + fd = open("/dev/ntsync", O_CLOEXEC | O_RDONLY);
> + ASSERT_GE(fd, 0);
> +
> + fd2 = open("/dev/ntsync", O_CLOEXEC | O_RDONLY);
> + ASSERT_GE(fd2, 0);
> +
> + sem = ioctl(fd, NTSYNC_IOC_CREATE_SEM, &sem_args);
> + EXPECT_GE(sem, 0);
> +
> + ret = wait_any(fd, 1, &sem, 0, &index);
> + EXPECT_EQ(-1, ret);
> + EXPECT_EQ(EINVAL, errno);
> +
> + ret = wait_all(fd, 1, &sem, 0, &index);
> + EXPECT_EQ(-1, ret);
> + EXPECT_EQ(EINVAL, errno);
> +
> + clock_gettime(CLOCK_MONOTONIC, &timeout);
> + wait_args.timeout = timeout.tv_sec * 1000000000ULL + timeout.tv_nsec;
> + wait_args.count = 0;
> + wait_args.objs = 0;
> + wait_args.owner = 123;
> + wait_args.pad = 1;
> + ret = ioctl(fd, NTSYNC_IOC_WAIT_ANY, &wait_args);
> + EXPECT_EQ(-1, ret);
> + EXPECT_EQ(EINVAL, errno);
> +
> + ret = wait_any(fd2, 1, &sem, 123, &index);
> + EXPECT_EQ(-1, ret);
> + EXPECT_EQ(EINVAL, errno);
> +
> + close(sem);
> + close(fd2);
> + close(fd);
> +}
> +
> TEST_HARNESS_MAIN
>
Reviewed-by: Elizabeth Figura <zfigura@codeweavers.com>
next prev parent reply other threads:[~2026-07-01 16:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 2:42 [PATCH 0/4] ntsync documentation, selftests, and owner validation Iván Ezequiel Rodriguez
2026-06-28 2:42 ` [PATCH 1/4] docs: ntsync: align uAPI ioctl names and struct layout with ntsync.h Iván Ezequiel Rodriguez
2026-07-01 16:37 ` Elizabeth Figura
2026-06-28 2:42 ` [PATCH 2/4] selftests: ntsync: fix wake_all CREATE_EVENT fd expectation Iván Ezequiel Rodriguez
2026-07-01 16:38 ` Elizabeth Figura
2026-06-28 2:42 ` [PATCH 3/4] selftests: ntsync: add wait argument validation tests Iván Ezequiel Rodriguez
2026-07-01 16:38 ` Elizabeth Figura [this message]
2026-06-28 2:42 ` [PATCH 4/4] ntsync: reject wait ioctls with zero owner Iván Ezequiel Rodriguez
2026-07-01 16:38 ` Elizabeth Figura
2026-07-01 16:45 ` [PATCH 0/4] ntsync documentation, selftests, and owner validation Elizabeth Figura
-- strict thread matches above, loose matches on Subject: below --
2026-07-20 17:17 [PATCH 0/4] ntsync miscellaneous patches Elizabeth Figura
2026-07-20 17:17 ` [PATCH 3/4] selftests: ntsync: add wait argument validation tests Elizabeth Figura
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=4743910.LvFx2qVVIh@camazotz \
--to=zfigura@codeweavers.com \
--cc=ivanrwcm25@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wine-devel@winehq.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