Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4231227imm; Mon, 15 Oct 2018 11:09:51 -0700 (PDT) X-Google-Smtp-Source: ACcGV620bOHBMd+x8Bpql5N7BitcLKAnP9BW9TmKeCxyBc2NASJcwX+IXKIrJrPonMJ/eOWPJfss X-Received: by 2002:a17:902:830b:: with SMTP id bd11-v6mr17123238plb.249.1539626991513; Mon, 15 Oct 2018 11:09:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539626991; cv=none; d=google.com; s=arc-20160816; b=wXLrRuqAuXRHmSeAklC4T7GgO/DDGAq02vr/jHuw3dLqpJx5PwPKw9tSLOhcGi9VB3 ChEtR3Ar2FL9x/89oHSqZxjkd5R03otojet7SMFtuv5bX0InqvdtlsNyV7fAXuAt53VF KIP/eHk4SzY5HZzvLp8nA2MtVoH7pbXWlWLVSCmhGYRp25RlUzYs43TcMM+/WMJxtFKv S0fAAsJ0lGlRmbnxYujj7PlV0Wdbh2LOFMZB1KiyfFbiK2aoNl220pB1xAw1VWLf9Tpd TVvh+61uDzTvFUiq3Xt90C5adCDQ2pQnKD1US1SiKOFhMKOdfQ87ssus+djXLSzGyTER T9YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from; bh=OOls5kR1OOVvPZ4w49s1QIKZxazUXmDmZ+AMRKI4htg=; b=sn5pk7amEpWCorBaSlVb/ZWL/sU71ayJN41GiZy5FGwnh0gNZbEl2H28Sh/BBJo3BV DRHBgWlee3FrhsKW3J6vZgDByhREx8wwarjqVLQTDKv76mOMa5Rc45pPS7Uppw/C82WP V5HOy0uuk+BE3ElAvNUTMB5tNKBve5mVdaB/MGBCoYNnHO0gWG+wWv6rUvI5QJrQU3Ja UODYpYQB/alnnGXfd0jpNP7RnYJxipzqY5TnXSN8jwQ5f4DJl9wPhiFvQuIkX9QQwfNF o+0x+TFeE4wM51MASH5zKCMKxmIR7Jcf0ksJT7qiC/mPl0ne3Ld9inVApPqszIeFbaR3 bLqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7-v6si12148990pfm.93.2018.10.15.11.09.34; Mon, 15 Oct 2018 11:09:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726926AbeJPBx5 (ORCPT + 99 others); Mon, 15 Oct 2018 21:53:57 -0400 Received: from out01.mta.xmission.com ([166.70.13.231]:45637 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726715AbeJPBx4 (ORCPT ); Mon, 15 Oct 2018 21:53:56 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gC7HE-0002Cg-83; Mon, 15 Oct 2018 12:07:36 -0600 Received: from 67-3-154-154.omah.qwest.net ([67.3.154.154] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1gC7HD-0006lS-KC; Mon, 15 Oct 2018 12:07:36 -0600 From: ebiederm@xmission.com (Eric W. Biederman) To: Jann Horn Cc: Nagarathnam Muthusamy , kernel list , Andrew Morton , Serge Hallyn , Oleg Nesterov , Prakash Sangappa , Konstantin Khlebnikov , Andy Lutomirski References: <1539623427-10789-1-git-send-email-nagarathnam.muthusamy@oracle.com> Date: Mon, 15 Oct 2018 13:07:21 -0500 In-Reply-To: (Jann Horn's message of "Mon, 15 Oct 2018 19:22:12 +0200") Message-ID: <87o9bvm6cm.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1gC7HD-0006lS-KC;;;mid=<87o9bvm6cm.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=67.3.154.154;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1/UAhEtWZXa/np3flMs4hZDRHZCrCRgDMo= X-SA-Exim-Connect-IP: 67.3.154.154 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa07.xmission.com X-Spam-Level: X-Spam-Status: No, score=-0.2 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4198] * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa07 1397; Body=1 Fuz1=1 Fuz2=1] X-Spam-DCC: XMission; sa07 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ;Jann Horn X-Spam-Relay-Country: X-Spam-Timing: total 173 ms - load_scoreonly_sql: 0.07 (0.0%), signal_user_changed: 3.2 (1.8%), b_tie_ro: 2.2 (1.3%), parse: 0.79 (0.5%), extract_message_metadata: 2.7 (1.5%), get_uri_detail_list: 0.94 (0.5%), tests_pri_-1000: 3.9 (2.3%), tests_pri_-950: 1.24 (0.7%), tests_pri_-900: 1.04 (0.6%), tests_pri_-400: 18 (10.2%), check_bayes: 16 (9.4%), b_tokenize: 5 (3.0%), b_tok_get_all: 5 (3.0%), b_comp_prob: 1.66 (1.0%), b_tok_touch_all: 2.6 (1.5%), b_finish: 0.48 (0.3%), tests_pri_0: 126 (72.9%), check_dkim_signature: 0.51 (0.3%), check_dkim_adsp: 2.7 (1.6%), tests_pri_10: 2.1 (1.2%), tests_pri_500: 7 (3.9%), rewrite_mail: 0.00 (0.0%) Subject: Re: [RFC] Allow user namespace inside chroot X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jann Horn writes: > On Mon, Oct 15, 2018 at 7:10 PM wrote: >> @@ -1281,7 +1285,7 @@ static int userns_install(struct nsproxy *nsproxy, struct ns_common *ns) >> return -ENOMEM; >> >> put_user_ns(cred->user_ns); >> - set_cred_user_ns(cred, get_user_ns(user_ns)); >> + set_cred_user_ns(cred, get_user_ns(user_ns), 0); > > This looks bogus. With this, I think your restriction can be bypassed > if process A forks a child B, B creates a new user namespace, then A > enters the user namespace with setns() and has full capabilities. Am I > missing something? Nope. I feel silly for missing that angle. Even without the full capabilities the userns_install angle will place you at the root of the mount namespace outside of the chroot. At which point I have visions of the special cases multiplying like bunnies make this work. Without a very strong case I don't like this at all. Eric