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]
Date:	Thu, 17 May 2007 09:43:00 +0530
From:	"Satyam Sharma" <satyam.sharma@...il.com>
To:	"Ray Lee" <ray-lk@...rabbit.org>
Cc:	"Alan Stern" <stern@...land.harvard.edu>,
	LKML <linux-kernel@...r.kernel.org>,
	"Max Krasnyansky" <maxk@...lcomm.com>, marcel@...tmann.org,
	bluez-devel@...ts.sf.net
Subject: Re: [PATCH] make hci_notifier a blocking notifier (was Re: BUG: sleeping function called from invalid context at net/core/sock.c:1523)

On 5/17/07, Ray Lee <ray-lk@...rabbit.org> wrote:
> Apologies for taking so long to get back to you -- I've been on the
> road for the last week and have finally got to a point where I could
> test the patch.
>
> On 5/6/07, Satyam Sharma <satyam.sharma@...il.com> wrote:
> > (Dropped Pavel, Rafael and linux-pm from CC list, this isn't a PM
> > error so don't want to spam them; and added bluez-devel)
> >
> > On 5/7/07, Ray Lee <ray-lk@...rabbit.org> wrote:
> > > On 5/6/07, Alan Stern <stern@...land.harvard.edu> wrote:
> > > > On Sun, 6 May 2007, Satyam Sharma wrote:
> > > >
> > > > > Anyway, the hci_notifier is called from the following six call sites:
> > > > >
> > > > > hci_dev_open() and hci_dev_close() -> both called from
> > > > > hci_sock_ioctl() => both can sleep
> > > > > hci_register_dev() and hci_unregister_dev() => again both are capable
> > > > > of sleeping
> > > > > hci_suspend_dev() and hci_resume_dev() -> called from the .suspend()
> > > > > and .resume() of the hci_usb_driver, and again both of these can sleep
> > > > >
> > > > > Is there any other reason why hci_notifier must be an atomic notifier?
> > > > >
> > > > > (CC'ing Alan Stern just in case, apparently hci_notifier became atomic
> > > > > when notifier chains were classified into atomic / blocking)
> > > >
> > > > I don't remember exactly why this particular choice was made.  Perhaps we
> > > > found that the notifier callout routines didn't use any blocking
> > > > primitives (we may have been mistaken about this -- there was a lot of
> > > > code to check) and so therefore the choice didn't matter.  In that case we
> > > > probably just decided to make it an atomic notifier to keep things simple.
> > > >
> > > > As you found, changing it to a blocking notifier is very easy.  Provided
> > > > all the callers are non-atomic it should work just fine.
> > >
> > > Okay, I'll go ahead and try the patch, then, and report back.
> >
> > You'd still get the BUG message. To fully resolve the problem, we need
> > to make the hci_sock_dev_event() notifier callout blocking (which
> > happened with this patch) but also convert hci_sk_list.lock to a
> > rwsem, but some users of that rwlock (other than hci_sock_dev_event)
> > are atomic.
> >
> > However, please do try and get back, as your testing would still be
> > helpful to see whether converting hci_notifier to blocking had other
> > side-effects -- if you only see the same message again and otherwise
> > things seem fine, then we're good as far as at least this change was
> > concerned.
>
> Yes, it's roughly the same trace. There are some differences, though
> those are likely due to me finding a new way to trigger the issue. (My
> laptop has a button to turn the WiFi/Bluetooth on and off. Hitting
> that and causing a disconnect of the internal Bluetooth connector
> triggers the same issue without going through a suspend/resume cycle.)

Hi Ray,

This issue has actually been resolved, see the patch at:
http://lkml.org/lkml/2007/5/16/149

[ We've slightly altered the locking scheme, but it's also good to know
that converting hci_notifier to a blocking notifier doesn't cause any
troubles either. If this is fine with other drivers too, this could actually
be a separate patch. ]

I'll also soon send that patch to Andrew, will Cc you too.

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