From: Joe Seigh <jseigh_02@xemaps.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Notifier chains are unsafe
Date: Tue, 25 Oct 2005 12:59:03 -0400 [thread overview]
Message-ID: <djlo8l$7hv$1@sea.gmane.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0510241634410.4448-100000@iolanthe.rowland.org>
Alan Stern wrote:
> Has anyone been bothered by the fact that notifier chains are not safe
> with regard to registration and unregistration while the chain is in use?
> The notifier_chain_register and notifier_chain_unregister routines have
> writelock protections, but the corresponding readlock is never taken!
>
> It shouldn't be hard to make this work safely, even allowing such things
> as notifier routines unregistering themselves as they run. The patch
> below contains an example implementation, showing one way to do it.
>
> But doing this correctly requires knowing how notifier chains are used.
>
> Are they always called in process context, with interrupts enabled?
>
> Or do some get called in interrupt context?
>
> Are there any notifier chains invoked on a critical fast path?
> (I hope not...)
>
> How many different threads are likely to call a particular
> notifier chain at one time?
>
> Feedback is requested.
>
> Alan Stern
>
[...]
It's not clear how you are making this safe. You aren't using one
of the known solutions to this problem. For GC lock-free based solutions,
you can't use RCU since notify_call can sleep. You could use a
form of reference counting but you'd have to implement it yourself.
Ditto on RCU+SMR or some other form of proxy GC. Not implemented.
You could use COR (Copy On Read). Make a copy of the list while holding
a lock, release the lock, do the notifications, and then delete the copy
of the list.
The non-blocking schemes can do notify_calls after unregistration so you
need to take this into account. Whatever you're calling against still
has to be there and has to be in a meaningful state.
next prev parent reply other threads:[~2005-10-25 17:06 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-24 20:48 Notifier chains are unsafe Alan Stern
2005-10-25 16:59 ` Joe Seigh [this message]
2005-10-25 23:30 ` Chandra Seetharaman
2005-10-26 18:46 ` Alan Stern
2005-10-26 19:05 ` Andreas Kleen
2005-10-26 20:40 ` Alan Stern
2005-10-26 21:44 ` Andi Kleen
2005-10-26 23:20 ` Chandra Seetharaman
2005-10-27 1:17 ` Joe Seigh
2005-10-28 1:36 ` Chandra Seetharaman
2005-10-27 14:13 ` Alan Stern
2005-10-26 22:40 ` Chandra Seetharaman
2005-10-27 15:28 ` Alan Stern
2005-10-27 20:43 ` Chandra Seetharaman
2005-10-27 21:21 ` Alan Stern
2005-10-27 23:02 ` Chandra Seetharaman
2005-10-28 0:48 ` Keith Owens
2005-10-28 1:34 ` Chandra Seetharaman
2005-10-28 14:23 ` Alan Stern
2005-10-28 22:15 ` Chandra Seetharaman
2005-10-29 14:51 ` Alan Stern
2005-10-31 22:22 ` Chandra Seetharaman
2005-11-01 15:24 ` Alan Stern
2005-11-01 20:20 ` Chandra Seetharaman
2005-11-01 21:20 ` Alan Stern
2005-11-02 9:50 ` Keith Owens
2005-11-02 16:03 ` Alan Stern
[not found] ` <mailman.1130460600.30060.linux-kernel2news@redhat.com>
2005-10-28 4:35 ` Pete Zaitcev
2005-10-25 23:43 ` Andi Kleen
2005-10-26 0:01 ` Chandra Seetharaman
2005-10-26 17:11 ` Andreas Kleen
2005-10-27 2:46 ` Herbert Xu
2005-10-29 12:25 ` Joe Seigh
2005-10-26 6:11 ` Keith Owens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='djlo8l$7hv$1@sea.gmane.org' \
--to=jseigh_02@xemaps.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.