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: <alpine.LRH.2.00.1502111414170.16743@twin.jikos.cz>
Date:	Wed, 11 Feb 2015 14:15:28 +0100 (CET)
From:	Jiri Kosina <jkosina@...e.cz>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
cc:	Torvald Riegel <triegel@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: POSIX mutex destruction requirements vs. futexes

On Thu, 27 Nov 2014, Linus Torvalds wrote:

> On Thu, Nov 27, 2014 at 6:27 AM, Torvald Riegel <triegel@...hat.com> wrote:
> >
> > Using reference-counting in critical sections to decide when the mutex
> > protecting the critical section can be destroyed has been recently
> > discussed on LKML.   For example, something like this is supposed to
> > work:
> >
> > int free = 0;
> >
> >     mutex_lock(&s->lock);
> >     if (--s->refcount == 0)
> >         free = 1
> >     mutex_unlock(&s->lock);
> >     if (free)
> >         kfree(s);
> 
> Yeah, this is a nasty case. We've had this bug in the kernel, and only
> allow self-locking data structures with spinlocks (in which the unlock
> operation is guaranteed to release the lock and never touch the data
> structure afterwards in any way - no "unlock fastpath followed by
> still touching it").

BTW, is this even documented anywhere?

I don't think we can easily perform any runtime checks on this potentially 
pathological pattern (say, in lockdep), but I think we are clearly not 
even properly documenting it anywhere (at least 
Documentation/locking/mutex-design.txt doesn't mention it at all).

-- 
Jiri Kosina
SUSE Labs

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ