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] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830809092231h90712a6mc95b81229d64d6bc@mail.gmail.com>
Date:	Tue, 9 Sep 2008 22:31:24 -0700
From:	"Paul Menage" <menage@...gle.com>
To:	"Greg KH" <greg@...ah.com>
Cc:	"Lai Jiangshan" <laijs@...fujitsu.com>,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cgroups: fix probable race with put_css_set[_taskexit] and find_css_set

On Tue, Sep 9, 2008 at 10:01 PM, Greg KH <greg@...ah.com> wrote:
>
> What are you trying to solve here with this change?  I agree, it does
> seem a bit "chaotic" :)

There's a place in cgroups that uses kref_put() to release an object;
the release function *then* takes a write-lock and removes the object
from a lookup table; it could race with another thread that searches
the lookup table (while holding a read-lock) and does kref_get() on
the same object.

The current fix is for the release function to recheck inside the lock
that the object's refcount is still zero, and only actually
unlink/free it if so. And actually I've just realised that this isn't
actually even safe, since the thread that just acquired the object
could kref_put() it almost immediately, which would leave two threads
both trying to unlink/free the object.

The two solutions being considered are:

- add a kref_put_and_write_lock(), similar to atomic_dec_and_lock(),
which would ensure that the final refcount on the object was only
released inside the lock

- add a kref_get_if_not_zero(), which would prevent a lookup from
succeeding if another thread had just dropped the last reference on
the object.

Paul
--
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