Re: Notifier chains are unsafe
From: Chandra Seetharaman
Date: Thu Oct 27 2005 - 20:35:59 EST
On Fri, 2005-10-28 at 10:48 +1000, Keith Owens wrote:
> On Thu, 27 Oct 2005 16:02:08 -0700,
> Chandra Seetharaman <sekharan@xxxxxxxxxx> wrote:
> >On Thu, 2005-10-27 at 17:21 -0400, Alan Stern wrote:
> >> The other problem is that you violated Keith's statement that
> >> notifier_call_chain shouldn't take any locks. On the other hand, if we
> >
> >I would interpret Keith's comment like this: callout should not be
> >called with any locks held (because that would limit the callouts from
> >blocking).
>
> We should be able to call notifier_call_chain() from any context. That
> includes oops, panic, NMI and other unmaskable machine check events.
> If you can call notifier_call_chain() from an unmaskable context then
> it follows that the callbacks cannot take any locks. Locks are not
> safe in NMI context.
Thanks Keith.
That really ties our hands down.
So, requirements to fix the bug are:
- no sleeping in register/unregister(if we want to keep the
current way of use. We can change it and make the relevant
changes in the kernel code, if it is agreeable)
- notifier_call_chain could be called from any context
- callout function could sleep
- no acquiring locks in notifier_call_chain
- make sure the list is consistent :) (which is problem Alan
started to fix)
- anything else ?
Alan, i think your solution of maintaining two notifier chains satisfies
all the needs mentioned. Will look at it more closely and respond
tomorrow.
Thanks & Regards,
chandra
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>
--
----------------------------------------------------------------------
Chandra Seetharaman | Be careful what you choose....
- sekharan@xxxxxxxxxx | .......you may get it.
----------------------------------------------------------------------
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/