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:   Thu, 2 May 2019 10:37:16 -0700
From:   Matthew Wilcox <willy@...radead.org>
To:     Al Viro <viro@...iv.linux.org.uk>
Cc:     Kees Cook <keescook@...omium.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Subject: Re: Alloc refcount increments to fail

On Thu, May 02, 2019 at 04:46:44PM +0100, Al Viro wrote:
> On Thu, May 02, 2019 at 08:26:21AM -0700, Matthew Wilcox wrote:
> 
> > +/**
> > + * refcount_try_inc - Increment a refcount if it's below INT_MAX
> > + * @r: the refcount to increment
> > + *
> > + * Avoid the counter saturating by declining to increment the counter
> > + * if it is more than halfway to saturation.
> > + */
> > +static inline __must_check bool refcount_try_inc(refcount_t *r)
> > +{
> > +	if (refcount_read(r) < 0)
> > +		return false;
> > +	refcount_inc(r);
> > +	return true;
> > +}
> 
> So two of those in parallel with have zero protection, won't they?

We check that we're only halfway to saturation; sure we might go a
few dozen steps from INT_MAX towards UINT_MAX, but I have a hard time
believing that we'll get preempted for long enough that we'd get all
the way to UINT_MAX by unchecked increments on other CPUs/threads.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ