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]
Date:	Mon, 12 Dec 2011 12:15:56 +0100
From:	Oliver Neukum <oneukum@...e.de>
To:	Ming Lei <tom.leiming@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>, gregkh@...e.de,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	ostrikov@...dia.com, adobriyan@...il.com, eric.dumazet@...il.com,
	mingo@...e.hu
Subject: Re: [PATCH 3/3] kref: Remove the memory barriers

Am Montag, 12. Dezember 2011, 11:32:58 schrieb Ming Lei:
> On Mon, Dec 12, 2011 at 6:12 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > I don't know the driver model, and I don't plan to start learning it
> > now. But if what you said is possible its broken and no memory barriers
> > will fix it.
> 
> IMO, you don't need to learn it, and my example is very simple and common
> kref usage in device drivers, :-)
> 
> Could we only focus on it and see what is problem? and why won't memory
> barrier fix it?

You don't have a CPU ordering problem. If CPU A can do a kfree() you need to
make sure CPU B doesn't get a pointer to that object. Basically your race is:

CPU A							CPU B

p = a;
								p = a;
p->counter--;
if (!p->counter) kfree(p);
a = NULL;
								p->counter++;

This is not an ordering problem. You have a real critical section here.
It doesn't matter when CPU B sees the decrement.
You must make sure there are no pointers to objects you might free
if you intend to use the pointers without locks.

	Regards
		Oliver
--
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