* [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument
@ 2018-06-01 0:49 patrick.oppenlander
2018-06-01 1:01 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: patrick.oppenlander @ 2018-06-01 0:49 UTC (permalink / raw)
To: musl; +Cc: Patrick Oppenlander
From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
---
src/internal/pthread_impl.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
index fc2def63..97522bfe 100644
--- a/src/internal/pthread_impl.h
+++ b/src/internal/pthread_impl.h
@@ -155,8 +155,8 @@ static inline void __wake(volatile void *addr, int cnt, int priv)
static inline void __futexwait(volatile void *addr, int val, int priv)
{
if (priv) priv = FUTEX_PRIVATE;
- __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val) != -ENOSYS ||
- __syscall(SYS_futex, addr, FUTEX_WAIT, val);
+ __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS ||
+ __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0);
}
void __acquire_ptc(void);
--
2.17.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument
2018-06-01 0:49 [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument patrick.oppenlander
@ 2018-06-01 1:01 ` Rich Felker
2018-06-01 1:23 ` Patrick Oppenlander
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2018-06-01 1:01 UTC (permalink / raw)
To: musl
On Fri, Jun 01, 2018 at 10:49:20AM +1000, patrick.oppenlander@gmail.com wrote:
> From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
>
> ---
> src/internal/pthread_impl.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
> index fc2def63..97522bfe 100644
> --- a/src/internal/pthread_impl.h
> +++ b/src/internal/pthread_impl.h
> @@ -155,8 +155,8 @@ static inline void __wake(volatile void *addr, int cnt, int priv)
> static inline void __futexwait(volatile void *addr, int val, int priv)
> {
> if (priv) priv = FUTEX_PRIVATE;
> - __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val) != -ENOSYS ||
> - __syscall(SYS_futex, addr, FUTEX_WAIT, val);
> + __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS ||
> + __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0);
> }
>
> void __acquire_ptc(void);
> --
> 2.17.0
This looks correct. Did you hit things that broke because it was
missing?
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument
2018-06-01 1:01 ` Rich Felker
@ 2018-06-01 1:23 ` Patrick Oppenlander
2018-06-01 1:48 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: Patrick Oppenlander @ 2018-06-01 1:23 UTC (permalink / raw)
To: musl
[-- Attachment #1: Type: text/plain, Size: 1309 bytes --]
On Fri., 1 Jun. 2018, 11:01 Rich Felker, <dalias@libc.org> wrote:
> On Fri, Jun 01, 2018 at 10:49:20AM +1000, patrick.oppenlander@gmail.com
> wrote:
> > From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> >
> > ---
> > src/internal/pthread_impl.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
> > index fc2def63..97522bfe 100644
> > --- a/src/internal/pthread_impl.h
> > +++ b/src/internal/pthread_impl.h
> > @@ -155,8 +155,8 @@ static inline void __wake(volatile void *addr, int
> cnt, int priv)
> > static inline void __futexwait(volatile void *addr, int val, int priv)
> > {
> > if (priv) priv = FUTEX_PRIVATE;
> > - __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val) != -ENOSYS ||
> > - __syscall(SYS_futex, addr, FUTEX_WAIT, val);
> > + __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS ||
> > + __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0);
> > }
> >
> > void __acquire_ptc(void);
> > --
> > 2.17.0
>
> This looks correct. Did you hit things that broke because it was
> missing?
>
> Rich
>
Syscall argument validation in my nommu kernel caught it. I'm sure Linux
would catch it too.
I didn't prove that it causes observable issues in userspace.
Patrick
>
[-- Attachment #2: Type: text/html, Size: 2229 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument
2018-06-01 1:23 ` Patrick Oppenlander
@ 2018-06-01 1:48 ` Rich Felker
2018-06-01 2:02 ` Patrick Oppenlander
0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2018-06-01 1:48 UTC (permalink / raw)
To: musl
On Fri, Jun 01, 2018 at 11:23:11AM +1000, Patrick Oppenlander wrote:
> On Fri., 1 Jun. 2018, 11:01 Rich Felker, <dalias@libc.org> wrote:
>
> > On Fri, Jun 01, 2018 at 10:49:20AM +1000, patrick.oppenlander@gmail.com
> > wrote:
> > > From: Patrick Oppenlander <patrick.oppenlander@gmail.com>
> > >
> > > ---
> > > src/internal/pthread_impl.h | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h
> > > index fc2def63..97522bfe 100644
> > > --- a/src/internal/pthread_impl.h
> > > +++ b/src/internal/pthread_impl.h
> > > @@ -155,8 +155,8 @@ static inline void __wake(volatile void *addr, int
> > cnt, int priv)
> > > static inline void __futexwait(volatile void *addr, int val, int priv)
> > > {
> > > if (priv) priv = FUTEX_PRIVATE;
> > > - __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val) != -ENOSYS ||
> > > - __syscall(SYS_futex, addr, FUTEX_WAIT, val);
> > > + __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0) != -ENOSYS ||
> > > + __syscall(SYS_futex, addr, FUTEX_WAIT, val, 0);
> > > }
> > >
> > > void __acquire_ptc(void);
> > > --
> > > 2.17.0
> >
> > This looks correct. Did you hit things that broke because it was
> > missing?
> >
> > Rich
> >
>
> Syscall argument validation in my nommu kernel caught it. I'm sure Linux
> would catch it too.
>
> I didn't prove that it causes observable issues in userspace.
OK. I just like to know if there is a known visible failure users have
seen so I can document it in the commit message. But if nothing was
seen, no problem.
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument
2018-06-01 1:48 ` Rich Felker
@ 2018-06-01 2:02 ` Patrick Oppenlander
0 siblings, 0 replies; 5+ messages in thread
From: Patrick Oppenlander @ 2018-06-01 2:02 UTC (permalink / raw)
To: musl
On Fri, Jun 1, 2018 at 11:48 AM, Rich Felker <dalias@libc.org> wrote:
> OK. I just like to know if there is a known visible failure users have
> seen so I can document it in the commit message. But if nothing was
> seen, no problem.
Makes sense.
The test I was running (a pthread_barrier test from the open posix
test suite) passed even though the kernel was returning a EFAULT in
that case.
I can reproduce it and give you a backtrace of the failure path if it helps.
Patrick
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-06-01 2:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-01 0:49 [PATCH] SYS_futex FUTEX_WAIT requires a valid timeout argument patrick.oppenlander
2018-06-01 1:01 ` Rich Felker
2018-06-01 1:23 ` Patrick Oppenlander
2018-06-01 1:48 ` Rich Felker
2018-06-01 2:02 ` Patrick Oppenlander
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).