Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 15 Jul 2011 09:58:33 -0400
From: Stephen Smalley <sds@...ho.nsa.gov>
To: Vasiliy Kulikov <segoon@...nwall.com>
Cc: NeilBrown <neilb@...e.de>, kernel-hardening@...ts.openwall.com,
        Solar
 Designer <solar@...nwall.com>, James Morris <jmorris@...ei.org>,
        Linus
 Torvalds <torvalds@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Greg Kroah-Hartman <gregkh@...e.de>,
        Andrew Morton
 <akpm@...ux-foundation.org>,
        "David S. Miller" <davem@...emloft.net>, Jiri
 Slaby <jslaby@...e.cz>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        linux-fsdevel@...r.kernel.org,
        KOSAKI Motohiro
 <kosaki.motohiro@...fujitsu.com>,
        Eric Paris <eparis@...hat.com>, Willy
 Tarreau <w@....eu>,
        Sebastian Krahmer <krahmer@...e.de>
Subject: Re: Re: [PATCH] move RLIMIT_NPROC check from
 set_user() to do_execve_common()

On Fri, 2011-07-15 at 11:38 +0400, Vasiliy Kulikov wrote:
> Neil,
> 
> On Fri, Jul 15, 2011 at 17:06 +1000, NeilBrown wrote:
> > How about this then?
> 
> AFAIU, with this patch:
> 
> 1) setuid() doesn't fail in NPROC exceed case.
> 2) NPROC is forced on execve() after setuid().
> 3) execve() fails only if NPROC was exceeded during setuid() execution.
> 4) Other processes of the same user doesn't suffer from "occasional"
> execve() failures.
> 
> If it is correct, then I like the patch :)  It does RLIMIT_NPROC
> enforcement without mixing other execve() calls like -ow patch did.

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(); assuming the limits and credentials of
the app but never does an exec at all, as it is just loading the app's
class and executing it from memory.

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.

-- 
Stephen Smalley
National Security Agency

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.