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]
Message-ID: <2697076.1611660339@warthog.procyon.org.uk>
Date:   Tue, 26 Jan 2021 11:25:39 +0000
From:   David Howells <dhowells@...hat.com>
To:     Will Deacon <will@...nel.org>
Cc:     dhowells@...hat.com, peterz@...radead.org,
        Kees Cook <keescook@...omium.org>,
        Xiaoming Ni <nixiaoming@...wei.com>,
        David Windsor <dwindsor@...il.com>,
        Hans Liljestrand <ishkamiel@...il.com>,
        Elena Reshetova <elena.reshetova@...el.com>,
        Paul Moore <paul@...l-moore.com>, edumazet@...gle.com,
        paulmck@...nel.org, shakeelb@...gle.com,
        James Morris <jamorris@...ux.microsoft.com>,
        alex.huangjianhui@...wei.com, dylix.dailei@...wei.com,
        chenzefeng2@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] locking/refcount: Provide __refcount API to obtain the old value

Will Deacon <will@...nel.org> wrote:

> > @@ -219,9 +235,14 @@ static inline void refcount_add(int i, r
> >   *
> >   * Return: true if the increment was successful, false otherwise
> >   */
> > +static inline __must_check bool __refcount_inc_not_zero(refcount_t *r, int *oldp)
> > +{
> > +	return __refcount_add_not_zero(1, r, oldp);
> > +}
> 
> Where returning both a bool to indicate whether the old value was zero
> and also the old value itself is a bit OTT.

Actually, with the i386 cmpxchg, that makes sense.  You can use the Z flag to
give you the bool, saving on checking the old value.

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ