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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 14 May 2022 11:31:38 +0200
From:   Uros Bizjak <ubizjak@...il.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        "H. Peter Anvin" <hpa@...or.com>, Will Deacon <will@...nel.org>,
        Boqun Feng <boqun.feng@...il.com>,
        Mark Rutland <mark.rutland@....com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Marco Elver <elver@...gle.com>
Subject: Re: [PATCH v2 2/2] locking/atomic/x86: Introduce arch_try_cmpxchg64

On Sat, May 14, 2022 at 12:18 AM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Fri, May 13, 2022 at 05:30:09PM +0200, Uros Bizjak wrote:
>
>
> > +#define arch_try_cmpxchg64(ptr, po, n)                                       \
> > +     ((__typeof__(*(ptr)))__try_cmpxchg64((ptr), (unsigned long long *)(po), \
> > +                                          (unsigned long long)(n)))
>
> That doesn't look right (unless it's so late I really can't read
> anymore, in which case ignore me and I'll try again on monday). But the
> return value of try_cmpxchg is bool, not typeof(*ptr).

No, you are right, I was too eager when copying the code from the
above arch_cmpxchg64 definition. Unfortunately, although the cast is
benign and the compiler figures out that the cast is unnecessary, it
doesn't warn here...

Actually, since __try_cmpxchg64 is already bool, we don't need any
cast here, and the definition can be substantially simplified.

Thank you for another pair of eyes - I did eyeball this code
extensively, but the issue slipped through somehow.

Patch v3 is in the works.

Thanks,
Uros.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ