From: "André Almeida" <andrealmeid@collabora.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Darren Hart <dvhart@infradead.org>,
linux-kernel@vger.kernel.org, Davidlohr Bueso <dave@stgolabs.net>
Cc: "André Almeida" <andrealmeid@collabora.com>
Subject: [PATCH RESEND 1/2] selftests: futex: Make futex_waitv's invalid clockid test more robust
Date: Fri, 3 Dec 2021 10:28:07 -0300 [thread overview]
Message-ID: <20211203132808.16907-2-andrealmeid@collabora.com> (raw)
In-Reply-To: <20211203132808.16907-1-andrealmeid@collabora.com>
If we use NULL for *waiters, we may be triggering a different error
path. Use a valid value for this arguments to make sure that the invalid
clockid is the one triggering the EINVAL return.
Signed-off-by: André Almeida <andrealmeid@collabora.com>
---
tools/testing/selftests/futex/functional/futex_waitv.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/futex/functional/futex_waitv.c b/tools/testing/selftests/futex/functional/futex_waitv.c
index a94337f677e1..336b04dacd0e 100644
--- a/tools/testing/selftests/futex/functional/futex_waitv.c
+++ b/tools/testing/selftests/futex/functional/futex_waitv.c
@@ -217,12 +217,17 @@ int main(int argc, char *argv[])
}
/* Testing an invalid clockid */
+ waitv[0].uaddr = (uintptr_t)&futexes[0];
+ waitv[0].flags = FUTEX_PRIVATE_FLAG | FUTEX_32;
+ waitv[0].val = 0;
+ waitv[0].__reserved = 0;
+
if (clock_gettime(CLOCK_MONOTONIC, &to))
error("gettime64 failed\n", errno);
to.tv_sec++;
- res = futex_waitv(NULL, NR_FUTEXES, 0, &to, CLOCK_TAI);
+ res = futex_waitv(waitv, 1, 0, &to, CLOCK_TAI);
if (res == EINVAL) {
ksft_test_result_fail("futex_waitv private returned: %d %s\n",
res ? errno : res,
--
2.34.1
next prev parent reply other threads:[~2021-12-03 13:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 13:28 [PATCH RESEND 0/2] selftests: futex: Some improvements André Almeida
2021-12-03 13:28 ` André Almeida [this message]
2021-12-03 13:28 ` [PATCH RESEND 2/2] selftests: futex: Add FUTEX_LOCK_PI2 for timeout test André Almeida
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=20211203132808.16907-2-andrealmeid@collabora.com \
--to=andrealmeid@collabora.com \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--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®