* [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
@ 2020-09-16 11:07 Lukasz Majewski
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Lukasz Majewski @ 2020-09-16 11:07 UTC (permalink / raw)
To: Joseph Myers, Paul Eggert, Adhemerval Zanella
Cc: Alistair Francis, Arnd Bergmann, Alistair Francis, GNU C Library,
Florian Weimer, Carlos O'Donell, Stepan Golosunov,
Andreas Schwab, Zack Weinberg, Jeff Law, Lukasz Majewski
This change provides proper spelling of 32 bit __futex_abstimed_wait_cancelable32
function
---
sysdeps/nptl/futex-internal.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
index a2ee5804ec..a4fc1dc52f 100644
--- a/sysdeps/nptl/futex-internal.c
+++ b/sysdeps/nptl/futex-internal.c
@@ -24,10 +24,10 @@
#ifndef __ASSUME_TIME64_SYSCALLS
static int
-__futex_abstimed_wait_cancellable32 (unsigned int* futex_word,
- unsigned int expected, clockid_t clockid,
- const struct __timespec64* abstime,
- int private)
+__futex_abstimed_wait_cancelable32 (unsigned int* futex_word,
+ unsigned int expected, clockid_t clockid,
+ const struct __timespec64* abstime,
+ int private)
{
if (! in_time_t_range (abstime->tv_sec))
return -EOVERFLOW;
@@ -91,8 +91,8 @@ __futex_abstimed_wait_cancelable64 (unsigned int* futex_word,
FUTEX_BITSET_MATCH_ANY);
#ifndef __ASSUME_TIME64_SYSCALLS
if (err == -ENOSYS)
- err = __futex_abstimed_wait_cancellable32 (futex_word, expected,
- clockid, abstime, private);
+ err = __futex_abstimed_wait_cancelable32 (futex_word, expected,
+ clockid, abstime, private);
#endif
switch (err)
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32
2020-09-16 11:07 [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Lukasz Majewski
@ 2020-09-16 11:07 ` Lukasz Majewski
2020-09-16 12:06 ` Andreas Schwab
2020-09-16 14:59 ` Alistair Francis
2020-09-16 12:04 ` [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Andreas Schwab
2020-09-16 14:56 ` Alistair Francis
2 siblings, 2 replies; 8+ messages in thread
From: Lukasz Majewski @ 2020-09-16 11:07 UTC (permalink / raw)
To: Joseph Myers, Paul Eggert, Adhemerval Zanella
Cc: Alistair Francis, Arnd Bergmann, Alistair Francis, GNU C Library,
Florian Weimer, Carlos O'Donell, Stepan Golosunov,
Andreas Schwab, Zack Weinberg, Jeff Law, Lukasz Majewski
This change fixes issue when NULL pointer would be passed to
__futex_abstimed_wait_cancelable32.
The call log for passing NULL as *abstime pointer.
sem_wait (versioned symbol)
|
\|/
__new_sem_wait
| (here the NULL is passed as *abstime)
\|/
__new_sem_wait_slow64
|
\|/
do_futex_wait
|
\|/
__futex_abstimed_wait_cancelable64
|
\|/
__futex_abstimed_wait_cancellable32
In this function the *abstime is dereferenced when checking if we have
time_t in range and when converting to 32 bit struct timespec to pass it
to futex syscall, which supports 32 bit time.
---
sysdeps/nptl/futex-internal.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
index a4fc1dc52f..3211b4c94f 100644
--- a/sysdeps/nptl/futex-internal.c
+++ b/sysdeps/nptl/futex-internal.c
@@ -29,17 +29,21 @@ __futex_abstimed_wait_cancelable32 (unsigned int* futex_word,
const struct __timespec64* abstime,
int private)
{
- if (! in_time_t_range (abstime->tv_sec))
+ struct timespec ts32;
+
+ if (abstime != NULL && ! in_time_t_range (abstime->tv_sec))
return -EOVERFLOW;
unsigned int clockbit = (clockid == CLOCK_REALTIME)
? FUTEX_CLOCK_REALTIME : 0;
int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
- struct timespec ts32 = valid_timespec64_to_timespec (*abstime);
+ if (abstime != NULL)
+ ts32 = valid_timespec64_to_timespec (*abstime);
+
return INTERNAL_SYSCALL_CANCEL (futex, futex_word, op, expected,
- &ts32, NULL /* Unused. */,
- FUTEX_BITSET_MATCH_ANY);
+ abstime != NULL ? &ts32 : NULL,
+ NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY);
}
static int
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
2020-09-16 11:07 [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Lukasz Majewski
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
@ 2020-09-16 12:04 ` Andreas Schwab
2020-09-16 14:56 ` Alistair Francis
2 siblings, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2020-09-16 12:04 UTC (permalink / raw)
To: Lukasz Majewski
Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Alistair Francis,
Arnd Bergmann, Alistair Francis, GNU C Library, Florian Weimer,
Carlos O'Donell, Stepan Golosunov, Zack Weinberg, Jeff Law
On Sep 16 2020, Lukasz Majewski wrote:
> This change provides proper spelling of 32 bit __futex_abstimed_wait_cancelable32
> function
Ok.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
@ 2020-09-16 12:06 ` Andreas Schwab
2020-09-16 14:59 ` Alistair Francis
1 sibling, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2020-09-16 12:06 UTC (permalink / raw)
To: Lukasz Majewski
Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Alistair Francis,
Arnd Bergmann, Alistair Francis, GNU C Library, Florian Weimer,
Carlos O'Donell, Stepan Golosunov, Zack Weinberg, Jeff Law
On Sep 16 2020, Lukasz Majewski wrote:
> This change fixes issue when NULL pointer would be passed to
> __futex_abstimed_wait_cancelable32.
>
> The call log for passing NULL as *abstime pointer.
> sem_wait (versioned symbol)
> |
> \|/
> __new_sem_wait
> | (here the NULL is passed as *abstime)
> \|/
> __new_sem_wait_slow64
> |
> \|/
> do_futex_wait
> |
> \|/
> __futex_abstimed_wait_cancelable64
> |
> \|/
> __futex_abstimed_wait_cancellable32
This is now __futex_abstimed_wait_cancelable32.
> In this function the *abstime is dereferenced when checking if we have
> time_t in range and when converting to 32 bit struct timespec to pass it
> to futex syscall, which supports 32 bit time.
Ok.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
2020-09-16 11:07 [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Lukasz Majewski
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
2020-09-16 12:04 ` [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Andreas Schwab
@ 2020-09-16 14:56 ` Alistair Francis
2020-09-29 16:52 ` Lukasz Majewski
2 siblings, 1 reply; 8+ messages in thread
From: Alistair Francis @ 2020-09-16 14:56 UTC (permalink / raw)
To: Lukasz Majewski
Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Arnd Bergmann,
Alistair Francis, GNU C Library, Florian Weimer,
Carlos O'Donell, Stepan Golosunov, Andreas Schwab,
Zack Weinberg, Jeff Law
On Wed, Sep 16, 2020 at 4:07 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> This change provides proper spelling of 32 bit __futex_abstimed_wait_cancelable32
> function
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> sysdeps/nptl/futex-internal.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
> index a2ee5804ec..a4fc1dc52f 100644
> --- a/sysdeps/nptl/futex-internal.c
> +++ b/sysdeps/nptl/futex-internal.c
> @@ -24,10 +24,10 @@
>
> #ifndef __ASSUME_TIME64_SYSCALLS
> static int
> -__futex_abstimed_wait_cancellable32 (unsigned int* futex_word,
> - unsigned int expected, clockid_t clockid,
> - const struct __timespec64* abstime,
> - int private)
> +__futex_abstimed_wait_cancelable32 (unsigned int* futex_word,
> + unsigned int expected, clockid_t clockid,
> + const struct __timespec64* abstime,
> + int private)
> {
> if (! in_time_t_range (abstime->tv_sec))
> return -EOVERFLOW;
> @@ -91,8 +91,8 @@ __futex_abstimed_wait_cancelable64 (unsigned int* futex_word,
> FUTEX_BITSET_MATCH_ANY);
> #ifndef __ASSUME_TIME64_SYSCALLS
> if (err == -ENOSYS)
> - err = __futex_abstimed_wait_cancellable32 (futex_word, expected,
> - clockid, abstime, private);
> + err = __futex_abstimed_wait_cancelable32 (futex_word, expected,
> + clockid, abstime, private);
> #endif
>
> switch (err)
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
2020-09-16 12:06 ` Andreas Schwab
@ 2020-09-16 14:59 ` Alistair Francis
1 sibling, 0 replies; 8+ messages in thread
From: Alistair Francis @ 2020-09-16 14:59 UTC (permalink / raw)
To: Lukasz Majewski
Cc: Joseph Myers, Paul Eggert, Adhemerval Zanella, Arnd Bergmann,
Alistair Francis, GNU C Library, Florian Weimer,
Carlos O'Donell, Stepan Golosunov, Andreas Schwab,
Zack Weinberg, Jeff Law
On Wed, Sep 16, 2020 at 4:07 AM Lukasz Majewski <lukma@denx.de> wrote:
>
> This change fixes issue when NULL pointer would be passed to
> __futex_abstimed_wait_cancelable32.
>
> The call log for passing NULL as *abstime pointer.
> sem_wait (versioned symbol)
> |
> \|/
> __new_sem_wait
> | (here the NULL is passed as *abstime)
> \|/
> __new_sem_wait_slow64
> |
> \|/
> do_futex_wait
> |
> \|/
> __futex_abstimed_wait_cancelable64
> |
> \|/
> __futex_abstimed_wait_cancellable32
>
> In this function the *abstime is dereferenced when checking if we have
> time_t in range and when converting to 32 bit struct timespec to pass it
> to futex syscall, which supports 32 bit time.
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> sysdeps/nptl/futex-internal.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c
> index a4fc1dc52f..3211b4c94f 100644
> --- a/sysdeps/nptl/futex-internal.c
> +++ b/sysdeps/nptl/futex-internal.c
> @@ -29,17 +29,21 @@ __futex_abstimed_wait_cancelable32 (unsigned int* futex_word,
> const struct __timespec64* abstime,
> int private)
> {
> - if (! in_time_t_range (abstime->tv_sec))
> + struct timespec ts32;
> +
> + if (abstime != NULL && ! in_time_t_range (abstime->tv_sec))
> return -EOVERFLOW;
>
> unsigned int clockbit = (clockid == CLOCK_REALTIME)
> ? FUTEX_CLOCK_REALTIME : 0;
> int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private);
>
> - struct timespec ts32 = valid_timespec64_to_timespec (*abstime);
> + if (abstime != NULL)
> + ts32 = valid_timespec64_to_timespec (*abstime);
> +
> return INTERNAL_SYSCALL_CANCEL (futex, futex_word, op, expected,
> - &ts32, NULL /* Unused. */,
> - FUTEX_BITSET_MATCH_ANY);
> + abstime != NULL ? &ts32 : NULL,
> + NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY);
> }
>
> static int
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
2020-09-16 14:56 ` Alistair Francis
@ 2020-09-29 16:52 ` Lukasz Majewski
2020-09-29 18:11 ` Adhemerval Zanella
0 siblings, 1 reply; 8+ messages in thread
From: Lukasz Majewski @ 2020-09-29 16:52 UTC (permalink / raw)
To: Alistair Francis, Adhemerval Zanella
Cc: Joseph Myers, Paul Eggert, Arnd Bergmann, Alistair Francis,
GNU C Library, Florian Weimer, Carlos O'Donell,
Stepan Golosunov, Andreas Schwab, Zack Weinberg, Jeff Law
[-- Attachment #1: Type: text/plain, Size: 2304 bytes --]
Hi Adhemerval,
> On Wed, Sep 16, 2020 at 4:07 AM Lukasz Majewski <lukma@denx.de> wrote:
> >
> > This change provides proper spelling of 32 bit
> > __futex_abstimed_wait_cancelable32 function
Adhemerval, do you have any comments regarding this patch? Or shall I
pull it to -master?
>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
>
> Alistair
>
> > ---
> > sysdeps/nptl/futex-internal.c | 12 ++++++------
> > 1 file changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/sysdeps/nptl/futex-internal.c
> > b/sysdeps/nptl/futex-internal.c index a2ee5804ec..a4fc1dc52f 100644
> > --- a/sysdeps/nptl/futex-internal.c
> > +++ b/sysdeps/nptl/futex-internal.c
> > @@ -24,10 +24,10 @@
> >
> > #ifndef __ASSUME_TIME64_SYSCALLS
> > static int
> > -__futex_abstimed_wait_cancellable32 (unsigned int* futex_word,
> > - unsigned int expected,
> > clockid_t clockid,
> > - const struct __timespec64*
> > abstime,
> > - int private)
> > +__futex_abstimed_wait_cancelable32 (unsigned int* futex_word,
> > + unsigned int expected,
> > clockid_t clockid,
> > + const struct __timespec64*
> > abstime,
> > + int private)
> > {
> > if (! in_time_t_range (abstime->tv_sec))
> > return -EOVERFLOW;
> > @@ -91,8 +91,8 @@ __futex_abstimed_wait_cancelable64 (unsigned int*
> > futex_word, FUTEX_BITSET_MATCH_ANY);
> > #ifndef __ASSUME_TIME64_SYSCALLS
> > if (err == -ENOSYS)
> > - err = __futex_abstimed_wait_cancellable32 (futex_word,
> > expected,
> > - clockid, abstime,
> > private);
> > + err = __futex_abstimed_wait_cancelable32 (futex_word, expected,
> > + clockid, abstime,
> > private); #endif
> >
> > switch (err)
> > --
> > 2.20.1
> >
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait
2020-09-29 16:52 ` Lukasz Majewski
@ 2020-09-29 18:11 ` Adhemerval Zanella
0 siblings, 0 replies; 8+ messages in thread
From: Adhemerval Zanella @ 2020-09-29 18:11 UTC (permalink / raw)
To: Lukasz Majewski, Alistair Francis
Cc: Joseph Myers, Paul Eggert, Arnd Bergmann, Alistair Francis,
GNU C Library, Florian Weimer, Carlos O'Donell,
Stepan Golosunov, Andreas Schwab, Zack Weinberg, Jeff Law
On 29/09/2020 13:52, Lukasz Majewski wrote:
> Hi Adhemerval,
>
>> On Wed, Sep 16, 2020 at 4:07 AM Lukasz Majewski <lukma@denx.de> wrote:
>>>
>>> This change provides proper spelling of 32 bit
>>> __futex_abstimed_wait_cancelable32 function
>
> Adhemerval, do you have any comments regarding this patch? Or shall I
> pull it to -master?
>
LGTM, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-09-29 18:11 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 11:07 [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Lukasz Majewski
2020-09-16 11:07 ` [PATCH 2/2] nptl: Provide NULL abstime pointer handling in __futex_abstimed_wait_cancelable32 Lukasz Majewski
2020-09-16 12:06 ` Andreas Schwab
2020-09-16 14:59 ` Alistair Francis
2020-09-16 12:04 ` [PATCH 1/2] nptl: Provide proper spelling for 32 bit version of futex_abstimed_wait Andreas Schwab
2020-09-16 14:56 ` Alistair Francis
2020-09-29 16:52 ` Lukasz Majewski
2020-09-29 18:11 ` Adhemerval Zanella
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).