Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp5033472rwb; Wed, 17 Aug 2022 09:53:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MYW8Uj4DfdHzQErWEw1fYvGcC70TXZjbxMe9rDq2kB5nl9wIBxFPb1iGJQucWmaprA3OX X-Received: by 2002:a05:6a02:185:b0:41c:30f7:1fea with SMTP id bj5-20020a056a02018500b0041c30f71feamr21855318pgb.487.1660755203082; Wed, 17 Aug 2022 09:53:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660755203; cv=none; d=google.com; s=arc-20160816; b=EYwvBciDN25/p5y1Czi8HPXrenT5XKBTCmX6C+PmnniKROKq7dKLWsAdQXxeVAWcZX GHw4y2RsqE0e9ODj+gRGhofX4m56sKzDpAz6nMUtgHnyQQ8DOuiisdBjPZ7erpwI1nJX O+hWLx/nsIyzbtYJBKzwe2Vij4xDulnNdnaWnZq/t3RKj7qYqG2HEaxzanDV7ZpuT5Kv R4x4zOC7K+rXZqLuI4K9FZs+qSAWhrZUviSyA3F4iOFwEQQ0F1o6qy+g1lIV3ylHBxF4 HBKDXZJE3wtSITV+93PmyTRfaP3PXRiXFtk2hR06w4HP8ril3U8icwJKcsvKbCtNOInw lD4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=BaWHsWTr1OobN9zZcMtlpkKkIKQywBqe+CFVwSFeHqY=; b=h81BJu52sDcy+jW5kkI8Bv3/EmQK4jlPHIIjuj6pN18uD+pm7sFZIkDA1AdoZeIrfZ J3X+kTgEuxBkvYE2TzEie4ck/b+CD4IwDWD2yGyAa4J5sE6sBCapa0lYEmv8x7RBGJEO mVnn3yaT6xma3RXVaAKOjqD6vBK/a1iysrQzJbW6sfGhQ9jPOTaOOWlhr2asx5NfcEzs 9tHC5Rpo/p1yqjiCs94rtYyyMidxHusDJs3MiIIxLRaritYePXMucIRyhEngbCpMRmp2 3pqZomcA76S58oRUZJpFWJw5NISfRAVzImQiUZvy1s/0NtH6UWlJziDH0lGbNAGohdg9 3Q3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=eRiLLz7i; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 188-20020a6205c5000000b00528cc4fc308si16040546pff.268.2022.08.17.09.53.10; Wed, 17 Aug 2022 09:53:23 -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=@paul-moore-com.20210112.gappssmtp.com header.s=20210112 header.b=eRiLLz7i; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240838AbiHQQLG (ORCPT + 99 others); Wed, 17 Aug 2022 12:11:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241020AbiHQQKi (ORCPT ); Wed, 17 Aug 2022 12:10:38 -0400 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 120E99C22F for ; Wed, 17 Aug 2022 09:10:37 -0700 (PDT) Received: by mail-ot1-x32c.google.com with SMTP id v12-20020a9d7d0c000000b00638e210c995so1474271otn.13 for ; Wed, 17 Aug 2022 09:10:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paul-moore-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc; bh=BaWHsWTr1OobN9zZcMtlpkKkIKQywBqe+CFVwSFeHqY=; b=eRiLLz7igQjPx0JfYU8PprZO3DUuncdUb7Tmo9iIYCYI+dN3Mb88vbr7mMmOqEoI9q V2xWtfyfn4pLjjCSnsdRdW0UgmXWRJjLodEmXleglMWoLXvrMcgu7nf1/qbfr92RQjau ozNy8u7Jf3k2Xo3rUlZEDr/LYZC5sPGnLXykRG5ptTl0KmS4eJnGbHduTKQfDhC32+TK 4yShcnI/yVwlATurSSk/wAYIJt6Vlg3cHeoUqPO4xbn1CzYdtYEaXnbaIvZ2/AVnpmZD +vuNmhpsMagPEXW16q6VZZHO7gnyu6hbN/eCO0l94Z1+JaCbeoRbF4dpjn59CfcFBybA xqkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc; bh=BaWHsWTr1OobN9zZcMtlpkKkIKQywBqe+CFVwSFeHqY=; b=plydDISOkXU9nJM4VNj9KOo5HqND/IvJqvc/ThM/SnicJq3By7S5iEeN7wVYQWRSKc N23F//jxBj+Do5E1pX8RupFkjUox9lufmioZ+qZSvi6E1qRt7IoJ3XpEOjgbdSgYKQgt uIh/0jcljTonrloGiDlnFHjs3kfrjHn/NM5BuSQMqj+L+ulODv6qvKrnYS96mufzlOqL ZA1jjdjq7jCljp+QmA35ahe+xRcalocb/tB6xUAbkI/91WqF4biQq1HLcTvFAPMLJXlO uO9wBwHdyVZ22IPAfhQ/6javvEYZP0abOCXBrSlNqTJaZq/1gdcSLwO2XKpIS4HhGVpg WXTg== X-Gm-Message-State: ACgBeo1KI4moJTWxsqSaD/XgUzCY4jBCEpXdOIUTIE2f87ww2dPr7v1Z tulCgFLh49svIk6t7Jbq6v1i+/d4KvODgikC3ltp X-Received: by 2002:a05:6830:449e:b0:638:c72b:68ff with SMTP id r30-20020a056830449e00b00638c72b68ffmr3556247otv.26.1660752636346; Wed, 17 Aug 2022 09:10:36 -0700 (PDT) MIME-Version: 1.0 References: <20220725124123.12975-1-flaniel@linux.microsoft.com> <4420381.LvFx2qVVIh@pwmachine> In-Reply-To: From: Paul Moore Date: Wed, 17 Aug 2022 12:10:25 -0400 Message-ID: Subject: Re: [RFC PATCH v4 0/2] Add capabilities file to securityfs To: Casey Schaufler Cc: Francis Laniel , linux-security-module@vger.kernel.org, Eric Biederman , Serge Hallyn , James Morris , open list , "open list:BPF [MISC]" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Wed, Aug 17, 2022 at 11:50 AM Casey Schaufler w= rote: > On 8/17/2022 7:52 AM, Paul Moore wrote: > > On Wed, Aug 17, 2022 at 7:53 AM Francis Laniel > > wrote: > >> Le mardi 16 ao=C3=BBt 2022, 23:59:41 CEST Paul Moore a =C3=A9crit : > >>> On Mon, Jul 25, 2022 at 8:42 AM Francis Laniel > >>> > >>> wrote: > >>>> Hi. > >>>> > >>>> First, I hope you are fine and the same for your relatives. > >>> Hi Francis :) > >>> > >>>> A solution to this problem could be to add a way for the userspace t= o ask > >>>> the kernel about the capabilities it offers. > >>>> So, in this series, I added a new file to securityfs: > >>>> /sys/kernel/security/capabilities. > >>>> The goal of this file is to be used by "container world" software to= know > >>>> kernel capabilities at run time instead of compile time. > >>> ... > >>> > >>>> The kernel already exposes the last capability number under: > >>>> /proc/sys/kernel/cap_last_cap > >>> I'm not clear on why this patchset is needed, why can't the > >>> application simply read from "cap_last_cap" to determine what > >>> capabilities the kernel supports? > >> When you capabilities with, for example, docker, you will fill capabil= ities > >> like this: > >> docker run --rm --cap-add SYS_ADMIN debian:latest echo foo > >> As a consequence, the "echo foo" will be run with CAP_SYS_ADMIN set. > >> > >> Sadly, each time a new capability is added to the kernel, it means "co= ntainer > >> stack" software should add a new string corresponding to the number of= the > >> capabilities [1]. > > Thanks for clarifying things, I thought you were more concerned about > > detecting what capabilities the running kernel supported, I didn't > > realize it was getting a string literal for each supported capability. > > Unless there is a significant show of support for this > > I believe this could be a significant help in encouraging the use of > capabilities. An application that has to know the list of capabilities > at compile time but is expected to run unmodified for decades isn't > going to be satisfied with cap_last_cap. The best it can do with that > is abort, not being able to ask an admin what to do in the presence of > a capability that wasn't around before because the name isn't known. An application isn't going to be able to deduce the semantic value of a capability based solely on a string value, an integer is just as meaningful in that regard. What might be useful is if the application simply accepts a set of capabilities from the user and then checks those against the maximum supported by the kernel, but once again that doesn't require a string value, it just requires the application taking a set of integers and passing those into the kernel when a capability set is required. I still don't see how adding the capability string names to the kernel is useful here. --=20 paul-moore.com