From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756891AbaC0QVq (ORCPT ); Thu, 27 Mar 2014 12:21:46 -0400 Received: from mail-vc0-f176.google.com ([209.85.220.176]:39816 "EHLO mail-vc0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755185AbaC0QVo (ORCPT ); Thu, 27 Mar 2014 12:21:44 -0400 MIME-Version: 1.0 In-Reply-To: <533446A7.6020003@redhat.com> References: <20140327004225.GA20247@sergelap> <533446A7.6020003@redhat.com> From: Andy Lutomirski Date: Thu, 27 Mar 2014 09:21:22 -0700 Message-ID: Subject: Re: Thoughts on credential switching To: Florian Weimer 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 Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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