Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10238001rwl; Wed, 11 Jan 2023 16:58:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXswUlpih/cZERm5sj0Lgf0pM9LUW9AD5sxGPSJB/5bj/9v3my5yJ5BNhfv2RDlFWC9Uhhe7 X-Received: by 2002:a17:906:8a52:b0:84d:4732:65df with SMTP id gx18-20020a1709068a5200b0084d473265dfmr9871383ejc.61.1673485096700; Wed, 11 Jan 2023 16:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673485096; cv=none; d=google.com; s=arc-20160816; b=E0YkimqkXBoNas2bb/Fg+CT7cSEhwxvbJvK4G3xUNRMBm9gYHlow+mtEC4oKz+URrh rdAuWy4hSt2qdpZQaPimFuyOwS6ooLJ52ciSyYjRgQkFa53//A1Bx+9RwGIpm4Py9pJz aW0DEnW1i8DqFvUkRdVSUK4BjjC+oi/0lQYahYqWRLCKeYPo3pgCJSbglWm4plq+mbbM RMsVnoMy4DiI/24vqS1wA8BYUQ39u/S1TEYnNY3CozABoxcx8m+eig1Hjeh6EOEXAmaT NjaZxlgsiMIb9ohRBNuRVhtAeo9MSQU9x/OqP9G9fLW9xKRkYPzvF/KEnGWVGtudxeEK 0img== 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=W7I2kaMfttM+ttZ2kPzOe+fD329e9tMxlyBDmmg1uus=; b=ZWsjuLszl0ZrXA91G4N6Q7pmznwr4YeBKl4026UWj0B68HV57YRrtcVwDAdXMAPVxp 3maRRqgMAMTOOUfYexOETti4vyqiCCOUBZzXcheag7HKyqaDHCbnszt7UVjLi/NmFJab Fb7kwDQaDTyQ9HqY3aQDegmsbDG+UhY6PnIj5VkwD5JTT22m5aTA3q1bh+Kd36wldtpp 5P8OeW+F+BHpP/IeQy2k+07QpnaYb1hktBz76ft2B1sJjaw31oP9eLPi0Hzic5IqyReA bSEVGc1oUcyuwiZFKljx9kDCsyb8R8pC6rRtuIOEhqloAZjlJ0Ov5U2diI1GnQxmywmI Cd/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=bPbS8p+q; 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 hb35-20020a170907162300b0085124f139a5si8571312ejc.718.2023.01.11.16.58.03; Wed, 11 Jan 2023 16:58:16 -0800 (PST) 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=@yahoo.com header.s=s2048 header.b=bPbS8p+q; 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 S236039AbjALAjS (ORCPT + 52 others); Wed, 11 Jan 2023 19:39:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236544AbjALAij (ORCPT ); Wed, 11 Jan 2023 19:38:39 -0500 Received: from sonic310-31.consmr.mail.ne1.yahoo.com (sonic310-31.consmr.mail.ne1.yahoo.com [66.163.186.212]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03AAB44C69 for ; Wed, 11 Jan 2023 16:37:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673483878; bh=W7I2kaMfttM+ttZ2kPzOe+fD329e9tMxlyBDmmg1uus=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=bPbS8p+qGmsJ+gS18SXt04BdMJNbjV7lGFnqbB60sD+YqZQT1cGuMV2zYcWjolz8eL4GdBRCUGjbesUt30QoY5KzQRhy7yElurVyBrKwmSiEfOlGcS1EXqJE9xsnT7+CEjHQbU0xAs6OwhG+BOGdIvWr6bm2FZAmJrDGq7K9BW7KMAuvSoTvDx77gt8sosXZmK2yrMCwOERx97D4B1P66ByUyK93SxXw4DMFfNw0k2WeBsa5/0EfpmQwJtWnAhTqtdvVA53xjWfNQXbUck6qctVUm0UoNp79pqsxVLrpRW64v/zq8Td2/bZvOpPFEvfbICvr3XUiuv33YJc6e4IVUA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1673483878; bh=mHCceT0ZIuymVpwA19GRIjtceLYyTmJWNeXtP6sh8oe=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=sqLraq1BpKU59MQ55YSIlG6/FyrfQ0P0s3IReR23ciftu0314tYzuYLXpwF3885DPG1SVOCaVFV/rhWaMKuc6VKZ2k9mLT5R+eH85Dkb+lH/ZKdP+sqH046zbElxcHZZAxLUomb5D/OQ1SVxjxbZYwFapifYrAcQEZ04NhQzDd2FP0N00xd4ZLe5z7FyUY7ewOygH1mTV1W5LrrMnZ214KJRH4bcpLf3sULPM5HHrHu7cQcT6FebN46/xwVfuFx1G9az82GWVFIy9SnvlWSjNgO/TtVx/3cDTWpr6r1gDEVh9DVoay67dl7496p9NpsprFu++tSxS2/O5MKS302FeA== X-YMail-OSG: _IZfNaoVM1kYzaxdZrK.eLHDHwRGg55yMP24wWt_7wow3JZ3HNXccz0hzr0E4kc X.9xW5TBxq1bD863xfSDF2WcHsd1e0YV7fxlH6B2cx47nm1uBvQg6JcA87YK3cHbmcn6_FjArfhQ HP7.AHGFCPPcCLE4cIrWGfUdRgYbl6vY9H_UlIAgHP3ebWR4zR.k85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mr.mail.ne1.yahoo.com with HTTP; Thu, 12 Jan 2023 00:37:58 +0000 Received: by hermes--production-gq1-5d97db6675-b9fxh (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID ffe01bd5c3ab4930b448f81636554e9e; Thu, 12 Jan 2023 00:37:55 +0000 (UTC) Message-ID: <9b031aaa-08f8-3b99-64f8-a4ecadb3f7e8@schaufler-ca.com> Date: Wed, 11 Jan 2023 16:37:54 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH v5 3/8] proc: Use lsmids instead of lsm names for attrs Content-Language: en-US To: Paul Moore Cc: casey.schaufler@intel.com, linux-security-module@vger.kernel.org, jmorris@namei.org, keescook@chromium.org, john.johansen@canonical.com, penguin-kernel@i-love.sakura.ne.jp, stephen.smalley.work@gmail.com, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, mic@digikod.net, linux-fsdevel@vger.kernel.org, casey@schaufler-ca.com References: <20230109180717.58855-1-casey@schaufler-ca.com> <20230109180717.58855-4-casey@schaufler-ca.com> From: Casey Schaufler In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Mailer: WebService/1.1.21062 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE 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 1/11/2023 1:01 PM, Paul Moore wrote: > On Mon, Jan 9, 2023 at 1:09 PM Casey Schaufler wrote: >> Use the LSM ID number instead of the LSM name to identify which >> security module's attibute data should be shown in /proc/self/attr. >> The security_[gs]etprocattr() functions have been changed to expect >> the LSM ID. The change from a string comparison to an integer comparison >> in these functions will provide a minor performance improvement. >> >> Signed-off-by: Casey Schaufler >> Cc: linux-fsdevel@vger.kernel.org >> --- >> fs/proc/base.c | 29 +++++++++++++++-------------- >> fs/proc/internal.h | 2 +- >> include/linux/security.h | 11 +++++------ >> security/security.c | 11 +++++------ >> 4 files changed, 26 insertions(+), 27 deletions(-) > .. > >> diff --git a/fs/proc/base.c b/fs/proc/base.c >> index 9e479d7d202b..9328b6b07dfc 100644 >> --- a/fs/proc/base.c >> +++ b/fs/proc/base.c >> @@ -2837,27 +2838,27 @@ static const struct inode_operations proc_##LSM##_attr_dir_inode_ops = { \ >> >> #ifdef CONFIG_SECURITY_SMACK >> static const struct pid_entry smack_attr_dir_stuff[] = { >> - ATTR("smack", "current", 0666), >> + ATTR(LSM_ID_SMACK, "current", 0666), >> }; >> LSM_DIR_OPS(smack); >> #endif >> >> #ifdef CONFIG_SECURITY_APPARMOR >> static const struct pid_entry apparmor_attr_dir_stuff[] = { >> - ATTR("apparmor", "current", 0666), >> - ATTR("apparmor", "prev", 0444), >> - ATTR("apparmor", "exec", 0666), >> + ATTR(LSM_ID_APPARMOR, "current", 0666), >> + ATTR(LSM_ID_APPARMOR, "prev", 0444), >> + ATTR(LSM_ID_APPARMOR, "exec", 0666), >> }; >> LSM_DIR_OPS(apparmor); >> #endif >> >> static const struct pid_entry attr_dir_stuff[] = { >> - ATTR(NULL, "current", 0666), >> - ATTR(NULL, "prev", 0444), >> - ATTR(NULL, "exec", 0666), >> - ATTR(NULL, "fscreate", 0666), >> - ATTR(NULL, "keycreate", 0666), >> - ATTR(NULL, "sockcreate", 0666), >> + ATTR(0, "current", 0666), >> + ATTR(0, "prev", 0444), >> + ATTR(0, "exec", 0666), >> + ATTR(0, "fscreate", 0666), >> + ATTR(0, "keycreate", 0666), >> + ATTR(0, "sockcreate", 0666), > See the discussion in patch 1/8, we should use a macro instead of a 0 > here (although the exact macro definition is very much up for > discussion): > > ATTR(LSM_ID_UNDEF, "current", 0666), Or LSM_ID_NALSMID, or whatever. Agreed. > > -- > paul-moore.com