Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1360808rwb; Wed, 9 Nov 2022 17:02:28 -0800 (PST) X-Google-Smtp-Source: AMsMyM5GDFc9hKAbO/My5xhv0sWGyQGRzNo4scD+2AcwX0vpthBFV0V1a3Z+WOL9Lse/tykolC3L X-Received: by 2002:a65:6e47:0:b0:438:c2f0:c0eb with SMTP id be7-20020a656e47000000b00438c2f0c0ebmr53408199pgb.236.1668042148190; Wed, 09 Nov 2022 17:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668042148; cv=none; d=google.com; s=arc-20160816; b=KhK68XyrVYBH7E8BKBfMZR/ZNJjm60pIwbXNqpFUAIbmTpLvz331EiwfZLIfG1FVTm gD19kIp1BlYCuuxbkHmP71sGuci6j5bV5XViKmfrVrNSAOKz4logAn6VTxg+zz0CWMF7 VV6CUaDYUBToNWc/Kwpsm3jlyyxIcVZgKxXN81avGD49Ov0a2hhQ9jhJAWFwDYMXi0NN amljCyR4yOUwybvFYpNOYzkKmYKVbx2Io8bogDWPEA9y4s/Z9JgAW+gqGes+0IWxArmv 1Ls3t+L4LICxuV51HVwa4paj38tdF7orEfRB9ITaZcxMEqFkOj28O8KB2rw7piOv7aIJ CwOA== 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=NWxJETnwXYjxKfg4fLafZHWiwPHR0jx6GnpdSyGD2Ic=; b=Pb4CVoMDC1VqJf7MpjiPt8fjMaPUhTDhZSJm5/hKNVbKGTQ5whktxOaHN6EtWjjpo6 DAoVbhg0CmK2ceu+nKRHztaEsydSSUtV4JZD5ekLwWLpMSe9cQnNkSfWTUyqvzKtQFDX ydmC2RO0N+bbMT9RPIv/wA+rrweCAKSlwKsiS0NGYLDCy9HkkZ66O9x2x27pkU8WYp+M +DocwZgZAg7ZcYPxd4lPMyb4ucxOfpNMG27G6fkFJRGQGpboWJprHqiKlJR2rjG6pSv4 435ZxJNBXt1K4mnzDvTRnXOlUE+vREuBIf7FJ6AUpgQKVudkLZ1TIghQpGfCvWLHa1fn WSBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=BwYwGeSi; 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 pf18-20020a17090b1d9200b0020a8db1da7bsi3308439pjb.170.2022.11.09.17.02.15; Wed, 09 Nov 2022 17:02:28 -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=BwYwGeSi; 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 S229974AbiKJArA (ORCPT + 93 others); Wed, 9 Nov 2022 19:47:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229861AbiKJAqy (ORCPT ); Wed, 9 Nov 2022 19:46:54 -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 2595D11C1F for ; Wed, 9 Nov 2022 16:46:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668041212; bh=NWxJETnwXYjxKfg4fLafZHWiwPHR0jx6GnpdSyGD2Ic=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From:Subject:Reply-To; b=BwYwGeSiOQ4dC0HPYGXtriJMBWusJiz6MSezClRE3meWveMOtyBxOfby0cd2etR1rjIaAvnMPggBs/ibmij0hL/7vU+gRtzKmmSTnWKBuequtSpGu7mSY+ciUe1BiYPPXmFYhKryy6d3jcDgUpQ6pjzbTWz55oULtTD1rlzPQrPZp5hNYWRlkpDjC6rIU2zfE5m8FeXR7Oc5irHNqys14JsKe5lwSC69Q9RL0uznaYzruXqfp72pongth60rqv2vRk44DCtwfYJDew3vN97O7DGF45c+rnGZ5xfF5C3e0/k3vYcipibB+JQKoSeXLTabFa553sUX7guivI3whjcXLg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1668041212; bh=03dG7kZZ5H0uOusCmpH63c1g+z/CKS7yXQKFDoJvTTE=; h=X-Sonic-MF:Date:Subject:To:From:From:Subject; b=sSfq4abDkq9HvmACBFXuDUt6RUIxXGmHxTfpXRxgoM64NDSkqJtEDQeij9TT1E3l60TmDmnYt+3xDYYLEqaUdb3X11gK5leQUhmos7l2q4EnrjCPepkHdiKpixz878Px1FVPZq+mETjwTKKyBdQ/LnAayHxFWRFrrchBuFkcQufK4hJsH9XaLmdnLc2VqKNF9PqKNMJeKMejXLoCVRjRgskiNlJ1bXUrZKhTPB96vSVFPqjcDOb1iLMEhbY+Bje05b09MrMBXn7xe0RP+njJpR3IgcH6rRnu5/VN9IbMIUgGX/T825A4Cirin1E+PJicU+hRAb+vkK3sNGaRasKvSQ== X-YMail-OSG: yWgdWOMVM1kC6vUVU814MJjOpthQToDLQgPI4iW2iDcii6Ou5PoVG7k0F7VoyZo VlS1QQEht7uY6u_KABXjW_dy4FzlQhK5CY3d0BpYP6vW_sG12Z2GcHy33hbKVJhdMJXJlqvk9vCa XTW7ajzLKyO1HqqwJrT7.r41dW485BhJj6sQALG7m6IJyoaKcn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mail.ne1.yahoo.com with HTTP; Thu, 10 Nov 2022 00:46:52 +0000 Received: by hermes--production-bf1-5878955b5f-gz9tn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID a811e673c5d07df95e71cc480422bcf7; Thu, 10 Nov 2022 00:46:51 +0000 (UTC) Message-ID: Date: Wed, 9 Nov 2022 16:46:48 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH v1 2/8] LSM: Add an LSM identifier for external use 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, casey@schaufler-ca.com References: <20221025184519.13231-1-casey@schaufler-ca.com> <20221025184519.13231-3-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.20826 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 11/9/2022 3:33 PM, Paul Moore wrote: > On Tue, Oct 25, 2022 at 2:45 PM Casey Schaufler wrote: >> Add an integer member "id" to the struct lsm_id. This value is >> a unique identifier associated with each security module. The >> values are defined in a new UAPI header file. Each existing LSM >> has been updated to include it's LSMID in the lsm_id. >> >> The LSM ID values are sequential, with the oldest module >> LSM_ID_CAPABILITY being the lowest value and the existing >> modules numbered in the order they were included in the >> main line kernel. The first 32 values (0 - 31) are reserved >> for some as yet unknown but important use. >> >> Signed-off-by: Casey Schaufler >> --- >> include/linux/lsm_hooks.h | 1 + >> include/uapi/linux/lsm.h | 32 ++++++++++++++++++++++++++++++++ >> security/apparmor/lsm.c | 2 ++ >> security/bpf/hooks.c | 2 ++ >> security/commoncap.c | 2 ++ >> security/landlock/setup.c | 2 ++ >> security/loadpin/loadpin.c | 2 ++ >> security/lockdown/lockdown.c | 2 ++ >> security/safesetid/lsm.c | 2 ++ >> security/selinux/hooks.c | 2 ++ >> security/smack/smack_lsm.c | 2 ++ >> security/tomoyo/tomoyo.c | 2 ++ >> security/yama/yama_lsm.c | 2 ++ >> 13 files changed, 55 insertions(+) >> create mode 100644 include/uapi/linux/lsm.h > Unless you're getting paid by the patch, I'd rather you combine > patches 1/8 and 2/8 into a single patch. They are both pretty small, > very related, and I don't want to see 1/8 merged anywhere without 2/8. OK by me. One less compile+test cycle. It's nice to know there's some limit on patch granularity. > >> diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h >> index e383e468f742..dd4b4d95a172 100644 >> --- a/include/linux/lsm_hooks.h >> +++ b/include/linux/lsm_hooks.h >> @@ -1607,6 +1607,7 @@ struct security_hook_heads { >> */ >> struct lsm_id { >> const char *lsm; /* Name of the LSM */ >> + int id; /* LSM ID */ >> }; > At the very least let's define lsm_id::id as an 'unsigned int' type, > but since we are going to see the lsm_id::id token used as part of the > kernel ABI (likely not in this struct) I agree with Greg's comments > about making the size more explicit. I would suggest __u32/u32 as > 32-bits should be plenty for this token. > > Given the other upstream discussions we may want to do something > similar with lsm_id::lsm and __u8/u8. I'm pretty sure I saw a similar > comment (by Greg?) elsewhere in this patchset when I was quickly > skimming these on my phone while away ... Yes. The API friendly typing will be in the next revision. > -- > paul-moore.com