Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp4075649iog; Tue, 28 Jun 2022 08:29:35 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tiYUm6aYjwKlHUnrMwUcRHEZBfJQXlsBUoyKAPBNJtOiMOpoKzbw6XcHONvcYAacB6Jbcd X-Received: by 2002:a17:906:51db:b0:722:ea9b:ff9e with SMTP id v27-20020a17090651db00b00722ea9bff9emr18689448ejk.16.1656430175531; Tue, 28 Jun 2022 08:29:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656430175; cv=none; d=google.com; s=arc-20160816; b=zAYAzDayRIui06+fmRAdBtI7fCQcBS1ZqrIVs/NpyqVqJR3uGkisrogdWkp+zafHbs 6+zyNY/Q142c8pktBpdZts9tgyCrckA91ina8soPWRyHvRYvERkHex9uVfmeGrWR4j2C jDUdoToPCD89pE+NahNsyoWIe99E1DjPyQnslM+muIwdX18VBXmNI/MzkeYFrXU9Q95b 9XF0FSQNTQoOw8DCKmIy616mRxnH25F6tZ6wrPNOdtE2smer/OzsOeo+L2utjQzj6R5q Ti6336SsJV4YogUTMg8uBh0kLG+/RaV7PqGYP/tSv1PZsclH4BWMLYx8Cgm62Nr4mgji nSVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=j8onA5YycLKvgtR2+Db5ek4DglhDGyf/OLtfUjKRawU=; b=UvZjC6R4y0hmmU50gQK4PREg3dLRlbQIpEWN39jSqlxNnYF3dvwP4KDepW1N9wCZRy Yq1TFYJ9THO2PdSWJ17W+1hW2/y6lazqnffzXSnMnuzk/S75tYi5Hsj6R9dS6W+5NLji 3TxQmF01V/3PmW29Ik24aTqEzOtm09o8DeSLWw8SlEwqSpqg2lfGNok5Im10/6TmZGS9 iNXwm0D0KyfqVWwATOno4Au8iQDvbi3qHmX3zrRXwUF1S0M3xdozuH/ekQEh56NpgwHj ToiatftkOaf0sp8kWH6162MDOLPzej/u4xDAvoUO7HMMCea2Y7BuKJmvjkf9K3Pc3h/H D7fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cloudflare.com header.s=google header.b=u6WOgNzk; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402278f00b00435781299b4si18317106ede.357.2022.06.28.08.29.09; Tue, 28 Jun 2022 08:29:35 -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=@cloudflare.com header.s=google header.b=u6WOgNzk; 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=REJECT sp=REJECT dis=NONE) header.from=cloudflare.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347995AbiF1POo (ORCPT + 99 others); Tue, 28 Jun 2022 11:14:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347959AbiF1POd (ORCPT ); Tue, 28 Jun 2022 11:14:33 -0400 Received: from mail-oa1-x2e.google.com (mail-oa1-x2e.google.com [IPv6:2001:4860:4864:20::2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984152DD47 for ; Tue, 28 Jun 2022 08:14:32 -0700 (PDT) Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-fe023ab520so17429441fac.10 for ; Tue, 28 Jun 2022 08:14:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=j8onA5YycLKvgtR2+Db5ek4DglhDGyf/OLtfUjKRawU=; b=u6WOgNzk0OTDG+9CtSE/K6ru5P4/825Mxogdf7Dswt+4t/A0V9RTEQu1NpcqxbuOa3 B4hqvjDfLFtBTP9KYVkOi3g7QlsZKUQzgD92kVESgJJxK+jXkXcvybUWXvwj/VmqoDIl 5xxDbbSUpmnkaQOKd5z4WWRNePbFeh98woYL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=j8onA5YycLKvgtR2+Db5ek4DglhDGyf/OLtfUjKRawU=; b=6JZmDFXSrNA4QPVL4yaRfWOpC4l0vOHbzchv4WXqSwE43xtHvM82RUGFi1GcCHmjtp g/qSnTtcPE8bFF+yIwo1Ih+iMEX51gBP3W6diuf5TZXzqP0CfZw8j8v+TvE7v3GNCIOe O0fhoPn3wrwTfb6wNjJHnS/YN30I4oo5MLJ+GFH1XgpzPV5LEkEMD99I9bxVpnWDDQyl YdU/4XWfKQ2tOnwRbA6pGRHvKlD33MbkWpan8fUyjlVVfqp2d0kIQHgLhi1Xp4aCqyVI 8XEmaWlI8O9Sr1qTZI94igs8ca2Rq0eFVb561iXzSPZTDAus88P1lQKd4M6hAfFcI47m it6A== X-Gm-Message-State: AJIora/a+B0oR2MpS04T3FG6MgyiZJ/EDvuLqEShIfhZ4XokAk8UYUo3 fpneZZw/zat/N6OtkvRcGV7uSQ== X-Received: by 2002:a05:6870:8195:b0:101:9342:bf1a with SMTP id k21-20020a056870819500b001019342bf1amr37752oae.149.1656429271809; Tue, 28 Jun 2022 08:14:31 -0700 (PDT) Received: from [192.168.0.41] ([184.4.90.121]) by smtp.gmail.com with ESMTPSA id x18-20020a056830409200b0060aeccf6b44sm8167298ott.41.2022.06.28.08.14.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Jun 2022 08:14:31 -0700 (PDT) Message-ID: <9ae473c4-cd42-bb45-bce2-8aa2e4784a43@cloudflare.com> Date: Tue, 28 Jun 2022 10:14:29 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 0/2] Introduce security_create_user_ns() Content-Language: en-US To: Casey Schaufler , Paul Moore , Daniel Borkmann Cc: Christian Brauner , kpsingh@kernel.org, revest@chromium.org, jackmanb@chromium.org, ast@kernel.org, andrii@kernel.org, kafai@fb.com, songliubraving@fb.com, yhs@fb.com, john.fastabend@gmail.com, jmorris@namei.org, serge@hallyn.com, bpf@vger.kernel.org, linux-security-module@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@cloudflare.com References: <20220621233939.993579-1-fred@cloudflare.com> <20220627121137.cnmctlxxtcgzwrws@wittgenstein> <6a8fba0a-c9c9-61ba-793a-c2e0c2924f88@iogearbox.net> <685096bb-af0a-08c0-491a-e176ac009e85@schaufler-ca.com> From: Frederick Lawler In-Reply-To: <685096bb-af0a-08c0-491a-e176ac009e85@schaufler-ca.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 6/27/22 6:18 PM, Casey Schaufler wrote: > On 6/27/2022 3:27 PM, Paul Moore wrote: >> On Mon, Jun 27, 2022 at 6:15 PM Daniel Borkmann >> wrote: >>> On 6/27/22 11:56 PM, Paul Moore wrote: >>>> On Mon, Jun 27, 2022 at 8:11 AM Christian Brauner >>>> wrote: >>>>> On Thu, Jun 23, 2022 at 11:21:37PM -0400, Paul Moore wrote: >>>> ... >>>> >>>>>> This is one of the reasons why I usually like to see at least one LSM >>>>>> implementation to go along with every new/modified hook.  The >>>>>> implementation forces you to think about what information is >>>>>> necessary >>>>>> to perform a basic access control decision; sometimes it isn't always >>>>>> obvious until you have to write the access control :) >>>>> I spoke to Frederick at length during LSS and as I've been given to >>>>> understand there's a eBPF program that would immediately use this new >>>>> hook. Now I don't want to get into the whole "Is the eBPF LSM hook >>>>> infrastructure an LSM" but I think we can let this count as a >>>>> legitimate >>>>> first user of this hook/code. >>>> Yes, for the most part I don't really worry about the "is a BPF LSM a >>>> LSM?" question, it's generally not important for most discussions. >>>> However, there is an issue unique to the BPF LSMs which I think is >>>> relevant here: there is no hook implementation code living under >>>> security/.  While I talked about a hook implementation being helpful >>>> to verify the hook prototype, it is also helpful in providing an >>>> in-tree example for other LSMs; unfortunately we don't get that same >>>> example value when the initial hook implementation is a BPF LSM. >>> I would argue that such a patch series must come together with a BPF >>> selftest which then i) contains an in-tree usage example, ii) adds BPF >>> CI test coverage. Shipping with a BPF selftest at least would be the >>> usual expectation. >> I'm not going to disagree with that, I generally require matching >> tests for new SELinux kernel code, but I was careful to mention code >> under 'security/' and not necessarily just a test implementation :)  I >> don't want to get into a big discussion about it, but I think having a >> working implementation somewhere under 'security/' is more >> discoverable for most LSM folks. > > I agree. It would be unfortunate if we added a hook explicitly for eBPF > only to discover that the proposed user needs something different. The > LSM community should have a chance to review the code before committing > to all the maintenance required in supporting it. > > Is there a reference on how to write an eBPF security module? There's a documentation page that briefly touches on a BPF LSM implementation [1]. > There should be something out there warning the eBPF programmer of the > implications of providing a secid_to_secctx hook for starters. > Links: 1. https://docs.kernel.org/bpf/prog_lsm.html?highlight=bpf+lsm#