From: "tip-bot2 for Terry Tritton" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Wei Gao <wegao@suse.com>,
Terry Tritton <terry.tritton@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: locking/urgent] selftests/futex: Convert 32-bit timespec to 64-bit version for 32-bit compatibility mode
Date: Sun, 06 Jul 2025 09:23:58 -0000 [thread overview]
Message-ID: <175179383900.406.10876682854606019107.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20250704190234.14230-1-terry.tritton@linaro.org>
The following commit has been merged into the locking/urgent branch of tip:
Commit-ID: d0a48dc4df5c986bf8c3caf4d8fc15c480273052
Gitweb: https://git.kernel.org/tip/d0a48dc4df5c986bf8c3caf4d8fc15c480273052
Author: Terry Tritton <terry.tritton@linaro.org>
AuthorDate: Fri, 04 Jul 2025 20:02:34 +01:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Sun, 06 Jul 2025 11:15:29 +02:00
selftests/futex: Convert 32-bit timespec to 64-bit version for 32-bit compatibility mode
sys_futex_wait() expects a struct __kernel_timespec pointer for the
timeout, but the provided struct timespec pointer is of type struct
old_timespec32 when compiled for 32-bit architectures, unless they use
64-bit timespecs already.
Make it work for all variants by converting the provided timespec value
into a local struct __kernel_timespec and provide a pointer to it to the
syscall. This is a pointless operation for 64-bit, but this is not a
hotpath operation, so keep it simple.
This fix is based off [1]
Originally-by: Wei Gao <wegao@suse.com>
Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250704190234.14230-1-terry.tritton@linaro.org
Link: https://lore.kernel.org/all/20231203235117.29677-1-wegao@suse.com/ [1]
---
tools/testing/selftests/futex/include/futex2test.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/futex/include/futex2test.h b/tools/testing/selftests/futex/include/futex2test.h
index ea79662..1f625b3 100644
--- a/tools/testing/selftests/futex/include/futex2test.h
+++ b/tools/testing/selftests/futex/include/futex2test.h
@@ -4,6 +4,7 @@
*
* Copyright 2021 Collabora Ltd.
*/
+#include <linux/time_types.h>
#include <stdint.h>
#define u64_to_ptr(x) ((void *)(uintptr_t)(x))
@@ -65,7 +66,12 @@ struct futex32_numa {
static inline int futex_waitv(volatile struct futex_waitv *waiters, unsigned long nr_waiters,
unsigned long flags, struct timespec *timo, clockid_t clockid)
{
- return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid);
+ struct __kernel_timespec ts = {
+ .tv_sec = timo->tv_sec,
+ .tv_nsec = timo->tv_nsec,
+ };
+
+ return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, &ts, clockid);
}
/*
prev parent reply other threads:[~2025-07-06 9:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-04 19:02 [PATCH v5] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit " Terry Tritton
2025-07-06 9:23 ` tip-bot2 for Terry Tritton [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=175179383900.406.10876682854606019107.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=terry.tritton@linaro.org \
--cc=tglx@linutronix.de \
--cc=wegao@suse.com \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®