Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750795AbVJ0ONM (ORCPT ); Thu, 27 Oct 2005 10:13:12 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750798AbVJ0ONM (ORCPT ); Thu, 27 Oct 2005 10:13:12 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:38887 "HELO iolanthe.rowland.org") by vger.kernel.org with SMTP id S1750795AbVJ0ONL (ORCPT ); Thu, 27 Oct 2005 10:13:11 -0400 Date: Thu, 27 Oct 2005 10:13:10 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andi Kleen cc: Chandra Seetharaman , Keith Owens , , Kernel development list Subject: Re: Notifier chains are unsafe In-Reply-To: <200510262344.37982.ak@suse.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1096 Lines: 24 On Wed, 26 Oct 2005, Andi Kleen wrote: > Like I wrote earlier: as long as the notifier doesn't unregister itself > the critical RCU section for the list walk is only a small part of notifier_call_chain. > It's basically a stable anchor in the list that won't change. I have to disagree with you. The critical section is the entire dynamic scope of notifier_call_chain. After all, what if a _different_ thread unregisters a notifier routine while the routine is running? What if the _following_ routine is unregistered also? The desired behavior for notifier_unregister is that when it returns, the notifier routine is not running on any processor and will not start running. The only way to guarantee this is to put the entire routine into the critical section. And that means putting the entire chain into the critical section. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/