From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751696Ab1ITQvK (ORCPT ); Tue, 20 Sep 2011 12:51:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416Ab1ITQvJ (ORCPT ); Tue, 20 Sep 2011 12:51:09 -0400 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20110920163805.GA20804@redhat.com> References: <20110920163805.GA20804@redhat.com> <20110920143959.GC15859@redhat.com> <20110919214531.GA18085@sergelap> <20110920122202.GA26504@redhat.com> <20110920124419.GA10759@hallyn.com> <20110920134108.GA30749@redhat.com> <20110920143920.GA15859@redhat.com> <5088.1316535551@redhat.com> To: Oleg Nesterov Cc: dhowells@redhat.com, "Serge E. Hallyn" , Andrew Morton , "Paul E. McKenney" , "Serge E. Hallyn" , lkml , richard@nod.at, "Eric W. Biederman" , Tejun Heo Subject: Re: [PATCH 2/2] creds: __task_cred(current) doesn't need rcu_read_lock_held() Date: Tue, 20 Sep 2011 17:50:04 +0100 Message-ID: <5820.1316537404@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Oleg Nesterov wrote: > > > - rcu_dereference_protected(current->cred, 1) > > > > and: > > > > > - rcu_dereference_check(__t->real_cred, 0); \ > > > > you'll notice they aren't quite the same in one very fundamental way. > > Do you mean that this patch adds the unnecessary ACCESS_ONCE + > smp_read_barrier_depends() to current_cred() or I missed something > else? Something else. The current_cred() uses ->cred: * current_cred - Access the current task's subjective credentials and __task_cred() uses ->real_cred: * __task_cred - Access a task's objective credentials Ordinarily both pointers will point to the same set of creds, but this change will break anything that uses override_creds() + revert_creds() such as faccessat() and fscache. David