Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp2755285imn; Tue, 2 Aug 2022 14:48:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5fUvVGhnHynIvyeFjA+7A4TYv2ctNfzRDryVYl1s4hC4UL0K5DAMT7n0uv/g1pgtqyAJZG X-Received: by 2002:a17:90b:4ccb:b0:1f5:20b4:fc9e with SMTP id nd11-20020a17090b4ccb00b001f520b4fc9emr1579551pjb.69.1659476933009; Tue, 02 Aug 2022 14:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659476933; cv=none; d=google.com; s=arc-20160816; b=ob4rnogfIAG41BxITsVQ1/xbjMkXXCwW22fp8VcM19yyD2j1yL5mbszbSFVyBqbA/K AA3bqbZSH15xFL7ko/4txUfIGEm4O142dwtML1CcXXu3P+EI7p+ZdYDjFvsO9az5Edqr HhwNGDg5s2PHqav3+37JUkXdzukxiPbwv34Au4kypMd4sq8tLg/vg9FaOPc3quAfzffn VfAWxB39V+EbZVM6cvKAk1RdNodlv88r/IXX2mYfSIjF2h/zgR7licS2mpQ10i5OBbzd OubfaRDfuQJn19X/NW+1QWhMdHmk1cg5kzSgSSrbTivdmbUwftOKSzbMEXJm+FcnrEUa DI0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=1EWVwXuVgnYFfqkcU2eaT4QdL5UizmGpTs3P6wbdHRo=; b=xikZz2r2uBkNZjng6PTYTOtPWlEcW5QVKW+hUYHivb5amk8lpTVb8FBDW/N1I/EEBU VWNwisl8pYfeUisZY6Q7kFX9mvIuTeI0S5iLiRYVUDKsK7QIbz2IIFxBD+b2w3/bg7zA 00S3VvLMYIrOJSlbiWDFBSec/vtxwLTh3rOsHwAizYE/UqfhjUTOx4pPCA2ih8h0V90g EB45oyLCPpcSzeBQ1trp8xxu42atldHUXljIOWumfXkgiF5H4pV9jXT7TJwNmgoDzgYA 1bGnRO1g3b7SBFxFlhLxgw37VoqLULZDEtJRoUA/FxCQW3ybHnbmN4ipKHOv6uX5AFVo Fw2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bR/qioeY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p23-20020a056a000a1700b0052e11b066bcsi1179611pfh.166.2022.08.02.14.48.38; Tue, 02 Aug 2022 14:48:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="bR/qioeY"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232716AbiHBVZS (ORCPT + 99 others); Tue, 2 Aug 2022 17:25:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232311AbiHBVZO (ORCPT ); Tue, 2 Aug 2022 17:25:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3FB11143 for ; Tue, 2 Aug 2022 14:25:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2610260C09 for ; Tue, 2 Aug 2022 21:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C5BEC433D7 for ; Tue, 2 Aug 2022 21:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659475511; bh=DRcXHF+hL2akkSQuSU/bab25l1HxDgWat6fbp5QgZhU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=bR/qioeYhsfMIBAQnO7sev2rDjT1MncB540KMDTiwIY8EWui0lhJiryo3qvJymfVQ QPi87451GYeehG76IdrqbkcLNmwZncDuTuUEzX2yHOeT8Bf0APt53GFq9fnJMlbqbZ idTn74DAL5U7R+Dm/LdrqhpTu9YHw2IpjWpIuDAm0iYmH5e5pwxUJz5aLjr97VjdaG cLQYFNVR7DKcZ4yQ0kPm+0XGu5k+IO2fJf/fIPT2iVWV+MlKAa6OJC/Ryx3M0tjjA3 p4Du0uWZFljxAtPqvm1kNW9JmNDR02g06XLzR4RshU7hWKqZNyQstkWqCN0Lmrvzqb MjlO36f9s1E+A== Received: by mail-ua1-f45.google.com with SMTP id z14so6279266uaq.13 for ; Tue, 02 Aug 2022 14:25:11 -0700 (PDT) X-Gm-Message-State: ACgBeo21ao9kVW0dW2IPmpSTSq80dn4Q+FX53L1u3xRjwX6a74oHP1Fr M10UiTFYu2WiAPIQyyg+bAoswxj2CVa0nTgFjuHr/A== X-Received: by 2002:a0d:f0c7:0:b0:31e:e814:e7d6 with SMTP id z190-20020a0df0c7000000b0031ee814e7d6mr20401368ywe.340.1659475500117; Tue, 02 Aug 2022 14:25:00 -0700 (PDT) MIME-Version: 1.0 References: <20220721172808.585539-1-fred@cloudflare.com> <20220722061137.jahbjeucrljn2y45@kafai-mbp.dhcp.thefacebook.com> <18225d94bf0.28e3.85c95baa4474aabc7814e68940a78392@paul-moore.com> In-Reply-To: From: KP Singh Date: Tue, 2 Aug 2022 23:24:49 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 0/4] Introduce security_create_user_ns() To: Paul Moore Cc: Frederick Lawler , Martin KaFai Lau , revest@chromium.org, jackmanb@chromium.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, jmorris@namei.org, serge@hallyn.com, stephen.smalley.work@gmail.com, eparis@parisplace.org, shuah@kernel.org, brauner@kernel.org, casey@schaufler-ca.com, ebiederm@xmission.com, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kernel-team@cloudflare.com, cgzones@googlemail.com, karl@bigbadwolfsecurity.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 1, 2022 at 5:19 PM Paul Moore wrote: > > On Mon, Aug 1, 2022 at 9:13 AM Frederick Lawler wrote: > > On 7/22/22 7:20 AM, Paul Moore wrote: > > > On July 22, 2022 2:12:03 AM Martin KaFai Lau wrote: > > > > > >> On Thu, Jul 21, 2022 at 12:28:04PM -0500, Frederick Lawler wrote: > > >>> While creating a LSM BPF MAC policy to block user namespace creation, we > > >>> used the LSM cred_prepare hook because that is the closest hook to prevent > > >>> a call to create_user_ns(). > > >>> > > >>> The calls look something like this: > > >>> > > >>> cred = prepare_creds() > > >>> security_prepare_creds() > > >>> call_int_hook(cred_prepare, ... > > >>> if (cred) > > >>> create_user_ns(cred) > > >>> > > >>> We noticed that error codes were not propagated from this hook and > > >>> introduced a patch [1] to propagate those errors. > > >>> > > >>> The discussion notes that security_prepare_creds() > > >>> is not appropriate for MAC policies, and instead the hook is > > >>> meant for LSM authors to prepare credentials for mutation. [2] > > >>> > > >>> Ultimately, we concluded that a better course of action is to introduce > > >>> a new security hook for LSM authors. [3] > > >>> > > >>> This patch set first introduces a new security_create_user_ns() function > > >>> and userns_create LSM hook, then marks the hook as sleepable in BPF. > > >> Patch 1 and 4 still need review from the lsm/security side. > > > > > > This patchset is in my review queue and assuming everything checks out, I expect to merge it after the upcoming merge window closes. > > > > > > I would also need an ACK from the BPF LSM folks, but they're CC'd on this patchset. > > > > Based on last weeks comments, should I go ahead and put up v4 for > > 5.20-rc1 when that drops, or do I need to wait for more feedback? > > In general it rarely hurts to make another revision, and I think > you've gotten some decent feedback on this draft, especially around > the BPF LSM tests; I think rebasing on Linus tree after the upcoming > io_uring changes are merged would be a good idea. Although as a > reminder to the BPF LSM folks - I'm looking at you KP Singh :) - I > need an ACK from you guys before I merge the BPF related patches Apologies, I was on vacation. I am looking at the patches now. Reviews and acks coming soon :) - KP > (patches {2,3}/4). For the record, I think the SELinux portion of > this patchset (path 4/4) is fine. > [...] > > -- > paul-moore.com