Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756121Ab0BJUbA (ORCPT ); Wed, 10 Feb 2010 15:31:00 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:42427 "EHLO e4.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755493Ab0BJUa4 (ORCPT ); Wed, 10 Feb 2010 15:30:56 -0500 Date: Wed, 10 Feb 2010 12:30:50 -0800 From: "Paul E. McKenney" To: "Serge E. Hallyn" Cc: Thomas Gleixner , Andrew Morton , Tetsuo Handa , oleg@redhat.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH] Update comment on find_task_by_pid_ns Message-ID: <20100210203050.GJ6737@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <201002082130.JDC57339.OHOVJFQtFSLFMO@I-love.SAKURA.ne.jp> <20100208132101.GA7129@redhat.com> <20100208171643.GA19230@redhat.com> <201002090642.EBE48414.HLJVFOQFSOFOMt@I-love.SAKURA.ne.jp> <20100209140818.43bb9770.akpm@linux-foundation.org> <20100210163033.GA12251@us.ibm.com> <20100210095710.c7b124f7.akpm@linux-foundation.org> <20100210201834.GA23001@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100210201834.GA23001@us.ibm.com> User-Agent: Mutt/1.5.15+20070412 (2007-04-11) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2346 Lines: 53 On Wed, Feb 10, 2010 at 02:18:34PM -0600, Serge E. Hallyn wrote: > Quoting Thomas Gleixner (tglx@linutronix.de): > > On Wed, 10 Feb 2010, Andrew Morton wrote: > > > On Wed, 10 Feb 2010 10:30:33 -0600 "Serge E. Hallyn" wrote: > > > > > > > Quoting Andrew Morton (akpm@linux-foundation.org): > > > > > On Tue, 9 Feb 2010 06:42:45 +0900 > > > > > Tetsuo Handa wrote: > > > > > > > > > > > OK. I updated description. > > > > > > > > > > > > As of 2.6.32 , below users are missing rcu_read_lock(). > > > > > > > > > > > > Users missing rcu_read_lock() when calling find_task_by_vpid(): > > > > > > > > > > > > SYSCALL_DEFINE3(ioprio_set) in fs/ioprio.c > > > > > > SYSCALL_DEFINE2(ioprio_get) in fs/ioprio.c > > > > > > cap_get_target_pid() in kernel/capability.c > > > > > > > > > > Actually, cap_get_target_pid() uses rcu_read_lock() and doesn't take > > > > > tasklist_lock. > > > > > > > > Hmm - is that in -mm? In my copy here it takes read_lock(&tasklist_lock) > > > > > > yup. It got changed in linux-next. > > > > > > > And I'll admit I'm a bit confused as to the current state of things: > > > > do I understand correctly that we now need to take both the tasklist_lock > > > > and rcu_read_lock? (Presumably only for read_lock()?) > > > > > > Beats me. We need to protect both the pid->task_struct lookup data > > > structures (during the lookup) and protect the resulting task_struct > > > while the caller is playing with it. It's unclear whether > > > rcu_read_lock() suffices for both purposes. > > > > The rcu_read_lock section is sufficient. task_struct can not go away > > before the rcu_read_unlock() > > But, more generally, it used to be the case that a spinlock (or > rwlock) would imply an rcu read cycle, but now it no longer does, > do I understand that right? You are correct, with CONFIG_PREEMPT_RCU, acquiring a lock does -not- imply an RCU read-side critical section. And acquiring a lock does -not- imply any sort of RCU read-side critical section in -rt kernels in any case. Thanx, Paul -- 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/