From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Lutomirski Subject: Re: Thoughts on credential switching Date: Thu, 27 Mar 2014 09:21:22 -0700 Message-ID: References: <20140327004225.GA20247@sergelap> <533446A7.6020003@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: Serge Hallyn , Jim Lieb , "Eric W. Biederman" , LSM List , "Serge E. Hallyn" , Kees Cook , Linux FS Devel , "Theodore Ts'o" , "linux-kernel@vger.kernel.org" , bfields@redhat.com, Jeff Layton To: Florian Weimer Return-path: In-Reply-To: <533446A7.6020003@redhat.com> Sender: linux-security-module-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Mar 27, 2014 at 8:41 AM, Florian Weimer wrote: > On 03/27/2014 02:01 AM, Andy Lutomirski wrote: > >> Essentially, it's a performance problem. knfsd has override_creds, >> and it can cache struct cred. But userspace doing the same thing >> (i.e. impersonating a user) has to do setresuid, setresgid, and >> setgroups, which kills performance, since it results in something like >> five RCU callbacks per impersonation round-trip. > > > Do you mean setfsuid instead of setresuid? No, but I should have given context. setfsuid sucks, since its return value is garbage. It's also pointless nowadays, since setresuid can be used to sanely change only the effective uid, and doing so should be secure. See: http://article.gmane.org/gmane.linux.kernel/1540880 --Andy