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: <Pine.LNX.4.44L0.0803261633190.9881-100000@iolanthe.rowland.org>
Date:	Wed, 26 Mar 2008 16:36:40 -0400 (EDT)
From:	Alan Stern <stern@...land.harvard.edu>
To:	"Rafael J. Wysocki" <rjw@...k.pl>
cc:	pm list <linux-pm@...ts.linux-foundation.org>,
	ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
	Greg KH <greg@...ah.com>, Len Brown <lenb@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Alexey Starikovskiy <astarikovskiy@...e.de>,
	David Brownell <david-b@...bell.net>,
	Pavel Machek <pavel@....cz>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>
Subject: Re: [RFC][PATCH] PM: Introduce new top level suspend and hibernation
 callbacks (rev. 3)

On Wed, 26 Mar 2008, Rafael J. Wysocki wrote:

> On Wednesday, 26 of March 2008, Alan Stern wrote:
> > On Tue, 25 Mar 2008, Rafael J. Wysocki wrote:
> > 
> > > > I just thought of another problem.  At the point where
> > > > local_irq_disable() is called, in between device_suspend() and
> > > > device_power_down(), it is possible in a preemptible kernel that
> > > > another task is holding dpm_list_mtx and is in the middle of updating
> > > > the list pointers.  This would mess up the traversal in
> > > > device_power_down().
> > > > 
> > > > I'm not sure about the best way to prevent this.  Is it legal to call
> > > > unlock_mutex() while interrupts or preemption are disabled?
> > > 
> > > Well, I think it is, but I'm not sure how that can help.
> > > 
> > > To prevent the race from happening, we can lock dpm_list_mtx before switching
> > > interrupts off in kernel/power/main.c:suspend_enter() and analogously in
> > > kernel/power/disk.c .
> > 
> > That's right.  And once interrupts are turned off you should unlock 
> > dpm_list_mtx again, in case a noirq method wants to unregister a 
> > device.
> 
> Why would a noirq method want to do that?  IMO, it's not a big deal if noirq
> methods are not allowed to unregister devices.

Okay, that's fine.  It keeps things simple.

> > Hence my question: Is it legal to call unlock_mutex() while interrupts are
> > disabled? 
> 
> Well, I suspect that will confuse lockdep quite a bit.  Otherwise, I don't see
> a problem with it (it's just changing the value of a shared variable after
> all).

Then you have your answer.  Perhaps have device_suspend() exit with the
mutex held and have device_resume() release it (with appropriate
handling for error situations, of course).

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