All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
@ 2025-07-01 14:23 Terry Tritton
  2025-07-01 14:31 ` Terry Tritton
  2025-07-01 20:34 ` Thomas Gleixner
  0 siblings, 2 replies; 6+ messages in thread
From: Terry Tritton @ 2025-07-01 14:23 UTC (permalink / raw)
  To: Thomas Gleixner, Shuah Khan, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida
  Cc: ttritton, linux-kselftest, linux-kernel, Terry Tritton, Wei Gao

Futex_waitv can not accept old_timespec32 struct, so userspace should
convert it from 32bit to 64bit before syscall in 32bit compatible mode.

This fix is based off [1]

Link: https://lore.kernel.org/all/20231203235117.29677-1-wegao@suse.com/ [1]

Signed-off-by: Wei Gao <wegao@suse.com>
Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
---
 .../testing/selftests/futex/include/futex2test.h  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tools/testing/selftests/futex/include/futex2test.h b/tools/testing/selftests/futex/include/futex2test.h
index ea79662405bc..6780e51eb2d6 100644
--- a/tools/testing/selftests/futex/include/futex2test.h
+++ b/tools/testing/selftests/futex/include/futex2test.h
@@ -55,6 +55,13 @@ struct futex32_numa {
 	futex_t numa;
 };
 
+#if !defined(__LP64__)
+struct timespec64 {
+	int64_t tv_sec;
+	int64_t tv_nsec;
+};
+#endif
+
 /**
  * futex_waitv - Wait at multiple futexes, wake on any
  * @waiters:    Array of waiters
@@ -65,7 +72,15 @@ 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)
 {
+#if !defined(__LP64__)
+	struct timespec64 timo64 = {0};
+
+	timo64.tv_sec = timo->tv_sec;
+	timo64.tv_nsec = timo->tv_nsec;
+	return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, &timo64, clockid);
+#else
 	return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid);
+#endif
 }
 
 /*
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
  2025-07-01 14:23 [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode Terry Tritton
@ 2025-07-01 14:31 ` Terry Tritton
  2025-07-01 20:34 ` Thomas Gleixner
  1 sibling, 0 replies; 6+ messages in thread
From: Terry Tritton @ 2025-07-01 14:31 UTC (permalink / raw)
  To: Thomas Gleixner, Shuah Khan, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida
  Cc: ttritton, linux-kselftest, linux-kernel, Wei Gao

Sorry forgot to save the change log before sending.
v2: fix Signed-off-by chain

On Tue, 1 Jul 2025 at 15:23, Terry Tritton <terry.tritton@linaro.org> wrote:
>
> Futex_waitv can not accept old_timespec32 struct, so userspace should
> convert it from 32bit to 64bit before syscall in 32bit compatible mode.
>
> This fix is based off [1]
>
> Link: https://lore.kernel.org/all/20231203235117.29677-1-wegao@suse.com/ [1]
>
> Signed-off-by: Wei Gao <wegao@suse.com>
> Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
> ---
>  .../testing/selftests/futex/include/futex2test.h  | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/tools/testing/selftests/futex/include/futex2test.h b/tools/testing/selftests/futex/include/futex2test.h
> index ea79662405bc..6780e51eb2d6 100644
> --- a/tools/testing/selftests/futex/include/futex2test.h
> +++ b/tools/testing/selftests/futex/include/futex2test.h
> @@ -55,6 +55,13 @@ struct futex32_numa {
>         futex_t numa;
>  };
>
> +#if !defined(__LP64__)
> +struct timespec64 {
> +       int64_t tv_sec;
> +       int64_t tv_nsec;
> +};
> +#endif
> +
>  /**
>   * futex_waitv - Wait at multiple futexes, wake on any
>   * @waiters:    Array of waiters
> @@ -65,7 +72,15 @@ 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)
>  {
> +#if !defined(__LP64__)
> +       struct timespec64 timo64 = {0};
> +
> +       timo64.tv_sec = timo->tv_sec;
> +       timo64.tv_nsec = timo->tv_nsec;
> +       return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, &timo64, clockid);
> +#else
>         return syscall(__NR_futex_waitv, waiters, nr_waiters, flags, timo, clockid);
> +#endif
>  }
>
>  /*
> --
> 2.39.5
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
  2025-07-01 14:23 [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode Terry Tritton
  2025-07-01 14:31 ` Terry Tritton
@ 2025-07-01 20:34 ` Thomas Gleixner
  2025-07-02 10:17   ` Terry Tritton
  2025-07-02 12:05   ` Wei Gao
  1 sibling, 2 replies; 6+ messages in thread
From: Thomas Gleixner @ 2025-07-01 20:34 UTC (permalink / raw)
  To: Terry Tritton, Shuah Khan, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida
  Cc: ttritton, linux-kselftest, linux-kernel, Terry Tritton, Wei Gao

On Tue, Jul 01 2025 at 15:23, Terry Tritton wrote:
> Futex_waitv can not accept old_timespec32 struct, so userspace should
> convert it from 32bit to 64bit before syscall in 32bit compatible mode.
>
> This fix is based off [1]
>
> Link: https://lore.kernel.org/all/20231203235117.29677-1-wegao@suse.com/ [1]
>
> Signed-off-by: Wei Gao <wegao@suse.com>
> Signed-off-by: Terry Tritton <terry.tritton@linaro.org>

This is still wrong.

If it is based on someone else work, then you need to attribute it
Originally-by and omit the Signed-off-by of the original author.

If you just picked it up and adopted it to a later kernel version then
you need to add 'From: Original Author' and preserve his Signed-off-by.

If you collaborated with him, then you want to use Co-developed-by.

All of this is documented in Documentation/process/


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
  2025-07-01 20:34 ` Thomas Gleixner
@ 2025-07-02 10:17   ` Terry Tritton
  2025-07-02 12:05   ` Wei Gao
  1 sibling, 0 replies; 6+ messages in thread
From: Terry Tritton @ 2025-07-02 10:17 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Shuah Khan, Ingo Molnar, Peter Zijlstra, Darren Hart,
	Davidlohr Bueso, André Almeida, ttritton, linux-kselftest,
	linux-kernel, Wei Gao

> > Signed-off-by: Wei Gao <wegao@suse.com>
> > Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
>
> This is still wrong.
>
> If it is based on someone else work, then you need to attribute it
> Originally-by and omit the Signed-off-by of the original author.
>
> If you just picked it up and adopted it to a later kernel version then
> you need to add 'From: Original Author' and preserve his Signed-off-by.
>
> If you collaborated with him, then you want to use Co-developed-by.
>
> All of this is documented in Documentation/process/
>

Ah sorry, I thought it was just the order that was wrong.

Thanks for pointing me in the right direction!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
  2025-07-02 12:05   ` Wei Gao
@ 2025-07-02 10:19     ` Terry Tritton
  0 siblings, 0 replies; 6+ messages in thread
From: Terry Tritton @ 2025-07-02 10:19 UTC (permalink / raw)
  To: Wei Gao
  Cc: Thomas Gleixner, Shuah Khan, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida, ttritton,
	linux-kselftest, linux-kernel

> > > Signed-off-by: Wei Gao <wegao@suse.com>
> > > Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
> >
> > This is still wrong.
> >
> > If it is based on someone else work, then you need to attribute it
> > Originally-by and omit the Signed-off-by of the original author.
> >
> > If you just picked it up and adopted it to a later kernel version then
> > you need to add 'From: Original Author' and preserve his Signed-off-by.
>
> @Terry @Thomas, Thank you both for the mention in the commit. I appreciate being included.
> I guess above options both good.

No problem!
Not sure how often this situation comes up where an ltp patch is also
needed in kselftest.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode
  2025-07-01 20:34 ` Thomas Gleixner
  2025-07-02 10:17   ` Terry Tritton
@ 2025-07-02 12:05   ` Wei Gao
  2025-07-02 10:19     ` Terry Tritton
  1 sibling, 1 reply; 6+ messages in thread
From: Wei Gao @ 2025-07-02 12:05 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Terry Tritton, Shuah Khan, Ingo Molnar, Peter Zijlstra,
	Darren Hart, Davidlohr Bueso, André Almeida, ttritton,
	linux-kselftest, linux-kernel

On Tue, Jul 01, 2025 at 10:34:28PM +0200, Thomas Gleixner wrote:
> On Tue, Jul 01 2025 at 15:23, Terry Tritton wrote:
> > Futex_waitv can not accept old_timespec32 struct, so userspace should
> > convert it from 32bit to 64bit before syscall in 32bit compatible mode.
> >
> > This fix is based off [1]
> >
> > Link: https://lore.kernel.org/all/20231203235117.29677-1-wegao@suse.com/ [1]
> >
> > Signed-off-by: Wei Gao <wegao@suse.com>
> > Signed-off-by: Terry Tritton <terry.tritton@linaro.org>
> 
> This is still wrong.
> 
> If it is based on someone else work, then you need to attribute it
> Originally-by and omit the Signed-off-by of the original author.
> 
> If you just picked it up and adopted it to a later kernel version then
> you need to add 'From: Original Author' and preserve his Signed-off-by.

@Terry @Thomas, Thank you both for the mention in the commit. I appreciate being included.
I guess above options both good.

> 
> If you collaborated with him, then you want to use Co-developed-by.
> 
> All of this is documented in Documentation/process/
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-07-02 10:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-01 14:23 [PATCH v2] selftests/futex: Convert 32bit timespec struct to 64bit version for 32bit compatibility mode Terry Tritton
2025-07-01 14:31 ` Terry Tritton
2025-07-01 20:34 ` Thomas Gleixner
2025-07-02 10:17   ` Terry Tritton
2025-07-02 12:05   ` Wei Gao
2025-07-02 10:19     ` Terry Tritton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.