From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kees Cook Subject: [PATCH security-next v3 08/29] LSM: Record LSM name in struct lsm_info Date: Mon, 24 Sep 2018 17:18:11 -0700 Message-ID: <20180925001832.18322-9-keescook@chromium.org> References: <20180925001832.18322-1-keescook@chromium.org> Return-path: In-Reply-To: <20180925001832.18322-1-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org To: James Morris Cc: Kees Cook , James Morris , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , Jonathan Corbet , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-arch.vger.kernel.org In preparation for making LSM selections outside of the LSMs, include the name of LSMs in struct lsm_info. Cc: James Morris Signed-off-by: Kees Cook --- include/linux/lsm_hooks.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 02ec717189f9..543636f18152 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -2040,16 +2040,20 @@ extern void security_add_hooks(struct security_hook_list *hooks, int count, char *lsm); struct lsm_info { + const char *name; /* Populated automatically. */ int (*init)(void); }; extern struct lsm_info __start_lsm_info[], __end_lsm_info[]; #define DEFINE_LSM(lsm) \ + static const char __lsm_name_##lsm[] __initconst \ + __aligned(1) = #lsm; \ static struct lsm_info __lsm_##lsm \ __used __section(.lsm_info.init) \ __aligned(sizeof(unsigned long)) \ = { \ + .name = __lsm_name_##lsm, \ #define END_LSM } -- 2.17.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-f193.google.com ([209.85.215.193]:37506 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbeIYGXb (ORCPT ); Tue, 25 Sep 2018 02:23:31 -0400 Received: by mail-pg1-f193.google.com with SMTP id c10-v6so3124560pgq.4 for ; Mon, 24 Sep 2018 17:18:45 -0700 (PDT) From: Kees Cook Subject: [PATCH security-next v3 08/29] LSM: Record LSM name in struct lsm_info Date: Mon, 24 Sep 2018 17:18:11 -0700 Message-ID: <20180925001832.18322-9-keescook@chromium.org> In-Reply-To: <20180925001832.18322-1-keescook@chromium.org> References: <20180925001832.18322-1-keescook@chromium.org> Sender: linux-arch-owner@vger.kernel.org List-ID: To: James Morris Cc: Kees Cook , James Morris , Casey Schaufler , John Johansen , Tetsuo Handa , Paul Moore , Stephen Smalley , "Schaufler, Casey" , LSM , Jonathan Corbet , linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20180925001811.KkcfQZdYK5osmUY_1iNFlX9oCcSs9SJT8I6cEY5sxxE@z> In preparation for making LSM selections outside of the LSMs, include the name of LSMs in struct lsm_info. Cc: James Morris Signed-off-by: Kees Cook --- include/linux/lsm_hooks.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index 02ec717189f9..543636f18152 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -2040,16 +2040,20 @@ extern void security_add_hooks(struct security_hook_list *hooks, int count, char *lsm); struct lsm_info { + const char *name; /* Populated automatically. */ int (*init)(void); }; extern struct lsm_info __start_lsm_info[], __end_lsm_info[]; #define DEFINE_LSM(lsm) \ + static const char __lsm_name_##lsm[] __initconst \ + __aligned(1) = #lsm; \ static struct lsm_info __lsm_##lsm \ __used __section(.lsm_info.init) \ __aligned(sizeof(unsigned long)) \ = { \ + .name = __lsm_name_##lsm, \ #define END_LSM } -- 2.17.1