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]

authored by Terry Tritton and committed by Thomas Gleixner d0a48dc4 46b0a67e

Changed files
+7 -1
tools
testing
selftests
futex
include
+7 -1
tools/testing/selftests/futex/include/futex2test.h
··· 4 4 * 5 5 * Copyright 2021 Collabora Ltd. 6 6 */ 7 + #include <linux/time_types.h> 7 8 #include <stdint.h> 8 9 9 10 #define u64_to_ptr(x) ((void *)(uintptr_t)(x)) ··· 66 65 static inline int futex_waitv(volatile struct futex_waitv *waiters, unsigned long nr_waiters, 67 66 unsigned long flags, struct timespec *timo, clockid_t clockid) 68 67 { 69 - return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid); 68 + struct __kernel_timespec ts = { 69 + .tv_sec = timo->tv_sec, 70 + .tv_nsec = timo->tv_nsec, 71 + }; 72 + 73 + return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, &ts, clockid); 70 74 } 71 75 72 76 /*