From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vasiliy Kulikov Subject: Re: [kernel-hardening] Re: [PATCH] move RLIMIT_NPROC check from set_user() to do_execve_common() Date: Fri, 15 Jul 2011 19:26:41 +0400 Message-ID: <20110715152641.GA6286@albatros> References: <20110713170657.59dae548@notabene.brown> <20110714112751.1bfd998f@notabene.brown> <20110714150602.GA30019@openwall.com> <20110715133013.4fa38d19@notabene.brown> <20110715063113.GA3166@albatros> <20110715170650.585f1dad@notabene.brown> <20110715073823.GA3821@albatros> <1310738313.30257.27.camel@moss-pluto> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: NeilBrown , kernel-hardening@lists.openwall.com, Solar Designer , James Morris , Linus Torvalds , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Andrew Morton , "David S. Miller" , Jiri Slaby , Alexander Viro , linux-fsdevel@vger.kernel.org, KOSAKI Motohiro , Eric Paris , Willy Tarreau , Sebastian Krahmer To: Stephen Smalley Return-path: Content-Disposition: inline In-Reply-To: <1310738313.30257.27.camel@moss-pluto> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi Stephen, On Fri, Jul 15, 2011 at 09:58 -0400, Stephen Smalley wrote: > Does this have implications for Android's zygote model? There you have > a long running uid 0 / all caps process (the zygote), which forks itself > upon receiving a request to spawn an app and then calls > setgroups(); > setrlimit(); setgid(); setuid(); Is RLIMIT_NPROC forced in your model and setuid() is expected to fail because of NPROC exceeding? If no, then it is not touched at all. > Also, can't setuid() fail under other conditions, e.g. ENOMEM upon > prepare_creds() allocation failure? Is it ever reasonable for a program > to not check setuid() for failure? Certainly there are plenty of > examples of programs not doing that, but it isn't clear that this is a > bug in the kernel. This thing is better to discuss separately, after the patch is applied. Shorter, in current implementation it is not possible as mm layer tries to alloc small structures (less than 8 pages) indefinitely. cred and user_struct are less than 64kb, so ENOMEM is impossible. Thanks, -- Vasiliy Kulikov http://www.openwall.com - bringing security into open computing environments