From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752945Ab1GOP0x (ORCPT ); Fri, 15 Jul 2011 11:26:53 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:44432 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751216Ab1GOP0v (ORCPT ); Fri, 15 Jul 2011 11:26:51 -0400 Date: Fri, 15 Jul 2011 19:26:41 +0400 From: Vasiliy Kulikov To: Stephen Smalley 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 Subject: Re: [kernel-hardening] Re: [PATCH] move RLIMIT_NPROC check from set_user() to do_execve_common() 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 Content-Disposition: inline In-Reply-To: <1310738313.30257.27.camel@moss-pluto> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@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