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-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.0912141619410.2690-100000@iolanthe.rowland.org>
Date:	Mon, 14 Dec 2009 16:33:38 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Tejun Heo <tj@...nel.org>
cc:	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Warn people about flush_scheduled_work()

Tejun:

You've spent some time working on the workqueue implementation, right?  
I'd like to add comments or kerneldoc warning people about how 
dangerous it can be to use flush_scheduled_work() and related 
functions.  Something like this:

	Think twice before calling this function!  It's very easy
	to get into trouble if you don't take great care.  Either
	of the following situations will lead to deadlock:

		Your code is running in the context of a scheduled
		work routine.

		Your code or its caller holds a lock needed by
		one of the work items currently on the workqueue.

	Since you generally don't know who your caller is, what locks
	it holds, or what locks are needed by the items on the 
	workqueue, avoiding these situations is quite difficult.

	Consider using cancel_work_sync() or cancel_delayed_work_sync()
	instead.  In most situations they will accomplish what you 
	need.

Does this sound like a good idea?  Certainly flush_scheduled_work()  
is used in places where it shouldn't be.

If comments like this are added, where do you think would be a good 
place to put them?

Alan Stern

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