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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20060822072656.b1a28a85.akpm@osdl.org>
Date:	Tue, 22 Aug 2006 07:26:56 -0700
From:	Andrew Morton <akpm@...l.org>
To:	Arjan van de Ven <arjan@...radead.org>
Cc:	Heiko Carstens <heiko.carstens@...ibm.com>,
	Greg KH <gregkh@...e.de>, Dave Jones <davej@...emonkey.org.uk>,
	linux-kernel@...r.kernel.org
Subject: Re: Lockdep message on workqueue_mutex

On Tue, 22 Aug 2006 14:36:32 +0200
Arjan van de Ven <arjan@...radead.org> wrote:

> On Tue, 2006-08-22 at 14:10 +0200, Heiko Carstens wrote:
> > git commit 9b41ea7289a589993d3daabc61f999b4147872c4 causes the lockdep
> > message below on cpu hotplug (git kernel of today).
> > 
> > We have:
> > 
> > cpu_down (takes cpu_add_remove_lock)
> > [CPU_DOWN_PREPARE]
> > blocking_notifier_call_chain (takes (cpu_chain).rwsem)
> > workqueue_cpu_callback (takes workqueue_mutex)
> > blocking_notifier_call_chain (releases (cpu_chain).rwsem)
> > [CPU_DEAD]
> > blocking_notifier_call_chain (takes (cpu_chain).rwsem)
> >                               ^^^^^^^^^^^^^^^^^^^^^^^
> > -> reverse locking order, since we still hold workqueue_mutex.
> > 
> > But since all of this is protected by the cpu_add_remove_lock this looks
> > legal. Well, at least it's safe as long as no other cpu callback function
> > does anything that will take the workqueue_mutex as well.
> 
> so you're saying this locking is entirely redundant ? ;-)

Nope, not all code paths which access the data which is protected by
workqueue_mutex take cpu_add_remove_lock.

Simplifying it, we have:

	blocking_notifier_call_chain()
	->down_read(cpu_chain.rwsem)
	->workqueue_cpu_callback()
	  ->mutex_lock(workqueue_mutex)
	->up_read(cpu_chain.rwsem)

	blocking_notifier_call_chain()
	->down_read(cpu_chain.rwsem)
	->workqueue_cpu_callback()
	  ->mutex_unlock(workqueue_mutex)
	->up_read(cpu_chain.rwsem)

Which is OK as long as nobody runs cpu_up() or cpu_down() while holding
workqueue_mutex.
-
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