lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 9 Nov 2021 14:05:11 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     André Almeida <andrealmeid@...labora.com>
Cc:     Vasily Gorbik <gor@...ux.ibm.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Darren Hart <dvhart@...radead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        Collabora kernel ML <kernel@...labora.com>,
        Gabriel Krisman Bertazi <krisman@...labora.com>,
        Linux API <linux-api@...r.kernel.org>,
        GNU C Library <libc-alpha@...rceware.org>,
        Michael Kerrisk <mtk.manpages@...il.com>,
        Davidlohr Bueso <dave@...olabs.net>,
        Arnd Bergmann <arnd@...db.de>,
        Alistair Francis <alistair.francis@....com>
Subject: Re: [PATCH v2 20/22] selftests: futex: Test sys_futex_waitv() timeout

On Tue, Nov 9, 2021 at 1:52 PM André Almeida <andrealmeid@...labora.com> wrote:
> Às 08:18 de 09/11/21, Vasily Gorbik escreveu:
> > On Thu, Sep 23, 2021 at 02:11:09PM -0300, André Almeida wrote:
> >> Test if the futex_waitv timeout is working as expected, using the
> >> supported clockid options.
> >
> >> +    /* futex_waitv with CLOCK_MONOTONIC */
> >> +    if (futex_get_abs_timeout(CLOCK_MONOTONIC, &to, timeout_ns))
> >> +            return RET_FAIL;
> >> +    res = futex_waitv(&waitv, 1, 0, &to, CLOCK_MONOTONIC);
> >> +    test_timeout(res, &ret, "futex_waitv monotonic", ETIMEDOUT);
> >> +
> >> +    /* futex_waitv with CLOCK_REALTIME */
> >> +    if (futex_get_abs_timeout(CLOCK_REALTIME, &to, timeout_ns))
> >> +            return RET_FAIL;
> >> +    res = futex_waitv(&waitv, 1, 0, &to, CLOCK_REALTIME);
> >> +    test_timeout(res, &ret, "futex_waitv realtime", ETIMEDOUT);
> >
> > Hi André,
> >
> > when built with -m32 and run as compat this two futex_waitv calls hang
> > on x86 and s390 (noticed while wiring up futex_waitv). The rest of the
> > futex selftests pass. This suggests some common compat issue? Any ideas?
>
> The issue is that futex_waitv() only accepts struct timespec that uses
> 64bit members. When using -m32, glibc will give you a 32bit timespec,
> thus the timeout won't wort. Someday glibc will provide 64bit timespec
> to 32bit userspace, given that this is affected by y2038 bug.

I think in the latest glibc you should be able to pass -D_TIME_BITS=64 to
the compiler to get the correct definition. Unfortunately, this only works
for simple test cases, but breaks if you call any interfaces from another
(non-glibc) library that depend on a particular time_t definition.

Alistair Francis also recently posted a set of helpers for the old futex()
call to make that easier to use from applications regardless of the libc
interface. I think it would be good to have this for futex_waitv() as well.

       Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ