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: <201203191225.00199.rjw@sisk.pl>
Date:	Mon, 19 Mar 2012 12:24:59 +0100
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Stephen Boyd <sboyd@...eaurora.org>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Saravana Kannan <skannan@...eaurora.org>,
	Kay Sievers <kay.sievers@...y.org>,
	Greg KH <gregkh@...uxfoundation.org>,
	Christian Lamparter <chunkeey@...glemail.com>,
	linux-kernel@...r.kernel.org,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	alan@...rguk.ukuu.org.uk,
	Linux PM mailing list <linux-pm@...r.kernel.org>
Subject: Re: [PATCH] firmware loader: don't cancel _nowait requests when helper is not yet available

On Monday, March 19, 2012, Stephen Boyd wrote:
> On 3/18/2012 5:01 AM, Rafael J. Wysocki wrote:
> > On Sunday, March 18, 2012, Stephen Boyd wrote:
> >
> >> Ok. I like where nowait() is going in the other part of the thread but
> >> I'm still confused about when request_firmware() is correct to use. It
> >> seems that the function is inherently racy with freezing. Does every
> >> user of request_firmware() need to synchronize with freezing?
> >>
> >> For example, if one CPU is in the middle of a driver probe that makes a
> >> request_firmware() call and another CPU is starting to suspend we will
> >> have a race between usermodehelpers being disabled and the
> >> request_firmware() call acquiring the usermodehelper rwsem. If the
> >> suspending CPU wins the race it will disable usermodehelpers and the
> >> request_firmware() call will return -EBUSY and warn.
> > Yes, it will.
> 
> That sounds wrong then, no? Why don't we have request_firmware() do a
> read_lock on the usermodehelpers sem and then have suspend do a write
> lock, disable usermodehelpers, wait for any users  to finish, freeze
> processes and then unlock the write lock? That way we don't hit a case
> where request_firmware() races with suspend, and we don't have to change
> the warning or conditional.

So, you're postulating that the freezing of tasks be done under
umhelper_sem write-locked, right?

That would lead to freezing failures if a user space task waited in
request_firmware() for umhelper_sem to become available for read-locking
and unfortunately we don't have an interruptible variant of down_read().

However, we may catch request_firmware() and try to freeze the task
calling it instead.  I'll try to prototype something along these lines later
today (on top of the three "firmware_class" patches I posted yesterday).

Thanks,
Rafael
--
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