From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756941Ab2AMBl5 (ORCPT ); Thu, 12 Jan 2012 20:41:57 -0500 Received: from mail-iy0-f174.google.com ([209.85.210.174]:44077 "EHLO mail-iy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752413Ab2AMBlz convert rfc822-to-8bit (ORCPT ); Thu, 12 Jan 2012 20:41:55 -0500 MIME-Version: 1.0 In-Reply-To: References: <1326411506-16894-1-git-send-email-wad@chromium.org> From: Andrew Lutomirski Date: Thu, 12 Jan 2012 17:41:33 -0800 X-Google-Sender-Auth: -jINoJ7CMaozEmc6KPVJ1eADej4 Message-ID: Subject: Re: [PATCH PLACEHOLDER 1/3] fs/exec: "always_unprivileged" patch To: Will Drewry Cc: Linus Torvalds , linux-kernel@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, serge.hallyn@canonical.com, coreyb@linux.vnet.ibm.com, pmoore@redhat.com, eparis@redhat.com, djm@mindrot.org, segoon@openwall.com, rostedt@goodmis.org, jmorris@namei.org, scarybeasts@gmail.com, avi@redhat.com, penberg@cs.helsinki.fi, viro@zeniv.linux.org.uk, mingo@elte.hu, akpm@linux-foundation.org, khilman@ti.com, borislav.petkov@amd.com, amwang@redhat.com, oleg@redhat.com, ak@linux.intel.com, eric.dumazet@gmail.com, gregkh@suse.de, dhowells@redhat.com, daniel.lezcano@free.fr, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, olofj@chromium.org, mhalcrow@google.com, dlaor@redhat.com, corbet@lwn.net, alan@lxorguk.ukuu.org.uk Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 12, 2012 at 5:37 PM, Will Drewry wrote: > On Thu, Jan 12, 2012 at 7:11 PM, Andrew Lutomirski wrote: >> (Also, preventing dropping of privileges will probably make a patch >> more complicted -- I'll have to find and update all the places that >> allow dropping privileges.) > > An alternative approach might be that the restricted bit drops all > privileges that allows privilege changes in either direction.  E.g., > - set restricted bit > -- adds a check anywhere MNT_NOSUID is > -- sets securebit to SECURE_NOROOT|..LOCKED > -- drops CAP_SETUID, CAP_DAC_OVERRIDE, ... > -- set the caps bounding set to the minimum the restricted bit allows > > That may deviate from the intent (by re-using caps), but it could keep some > of the privilege transition checking code the same. I'm not sure it'll be much of a simplification. The entire patch is 45 lines right now :) I'll test it and send it out. FWIW, though, it breaks apparmor (intentionally). Can any of you either explain what *should* happen or (better) volunteer to fix it? It should be about three lines of code for someone who understands what's going on. I don't have an apparmor system, so I can't really test it. --Andy > > Just a thought, > will From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lutomirski Subject: Re: [PATCH PLACEHOLDER 1/3] fs/exec: "always_unprivileged" patch Date: Thu, 12 Jan 2012 17:41:33 -0800 Message-ID: References: <1326411506-16894-1-git-send-email-wad@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Linus Torvalds , linux-kernel@vger.kernel.org, keescook@chromium.org, john.johansen@canonical.com, serge.hallyn@canonical.com, coreyb@linux.vnet.ibm.com, pmoore@redhat.com, eparis@redhat.com, djm@mindrot.org, segoon@openwall.com, rostedt@goodmis.org, jmorris@namei.org, scarybeasts@gmail.com, avi@redhat.com, penberg@cs.helsinki.fi, viro@zeniv.linux.org.uk, mingo@elte.hu, akpm@linux-foundation.org, khilman@ti.com, borislav.petkov@amd.com, amwang@redhat.com, oleg@redhat.com, ak@linux.intel.com, eric.dumazet@gmail.com, gregkh@suse.de, dhowells@redhat.com, daniel.lezcano@free.fr, linux-fsdevel@vger.kernel.org, linux-security-module@vger.kernel.org, olofj@chromium.org, mhalcrow@google.com, dlaor@redhat.com, corbet@lwn.net, alan@lxorguk.ukuu.org.uk To: Will Drewry Return-path: In-Reply-To: Sender: linux-security-module-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Thu, Jan 12, 2012 at 5:37 PM, Will Drewry wrote: > On Thu, Jan 12, 2012 at 7:11 PM, Andrew Lutomirski wro= te: >> (Also, preventing dropping of privileges will probably make a patch >> more complicted -- I'll have to find and update all the places that >> allow dropping privileges.) > > An alternative approach might be that the restricted bit drops all > privileges that allows privilege changes in either direction. =A0E.g.= , > - set restricted bit > -- adds a check anywhere MNT_NOSUID is > -- sets securebit to SECURE_NOROOT|..LOCKED > -- drops CAP_SETUID, CAP_DAC_OVERRIDE, ... > -- set the caps bounding set to the minimum the restricted bit allows > > That may deviate from the intent (by re-using caps), but it could kee= p some > of the privilege transition checking code the same. I'm not sure it'll be much of a simplification. The entire patch is 45 lines right now :) I'll test it and send it out. =46WIW, though, it breaks apparmor (intentionally). Can any of you either explain what *should* happen or (better) volunteer to fix it? It should be about three lines of code for someone who understands what's going on. I don't have an apparmor system, so I can't really test it. --Andy > > Just a thought, > will -- To unsubscribe from this list: send the line "unsubscribe linux-securit= y-module" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html