From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Johansen Subject: Re: [PATCH security-next v3 09/29] LSM: Provide init debugging infrastructure Date: Mon, 1 Oct 2018 14:14:19 -0700 Message-ID: References: <20180925001832.18322-1-keescook@chromium.org> <20180925001832.18322-10-keescook@chromium.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180925001832.18322-10-keescook@chromium.org> Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org To: Kees Cook , James Morris Cc: Casey Schaufler , 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 On 09/24/2018 05:18 PM, Kees Cook wrote: > Booting with "lsm.debug" will report future details on how LSM ordering > decisions are being made. > > Signed-off-by: Kees Cook Reviewed-by: John Johansen > --- > .../admin-guide/kernel-parameters.txt | 2 ++ > security/security.c | 18 ++++++++++++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 9871e649ffef..32d323ee9218 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -2274,6 +2274,8 @@ > ltpc= [NET] > Format: ,, > > + lsm.debug [SECURITY] Enable LSM initialization debugging output. > + > machvec= [IA-64] Force the use of a particular machine-vector > (machvec) in a generic kernel. > Example: machvec=hpzx1_swiotlb > diff --git a/security/security.c b/security/security.c > index e74f46fba591..ee49b921d750 100644 > --- a/security/security.c > +++ b/security/security.c > @@ -12,6 +12,8 @@ > * (at your option) any later version. > */ > > +#define pr_fmt(fmt) "LSM: " fmt > + > #include > #include > #include > @@ -43,11 +45,19 @@ char *lsm_names; > static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = > CONFIG_DEFAULT_SECURITY; > > +static bool debug __initdata; > +#define init_debug(...) \ > + do { \ > + if (debug) \ > + pr_info(__VA_ARGS__); \ > + } while (0) > + > static void __init major_lsm_init(void) > { > struct lsm_info *lsm; > > for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { > + init_debug("initializing %s\n", lsm->name); > lsm->init(); > } > } > @@ -91,6 +101,14 @@ static int __init choose_lsm(char *str) > } > __setup("security=", choose_lsm); > > +/* Enable LSM order debugging. */ > +static int __init enable_debug(char *str) > +{ > + debug = true; > + return 1; > +} > +__setup("lsm.debug", enable_debug); > + > static bool match_last_lsm(const char *list, const char *lsm) > { > const char *last; > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from youngberry.canonical.com ([91.189.89.112]:51156 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbeJBDyH (ORCPT ); Mon, 1 Oct 2018 23:54:07 -0400 Subject: Re: [PATCH security-next v3 09/29] LSM: Provide init debugging infrastructure References: <20180925001832.18322-1-keescook@chromium.org> <20180925001832.18322-10-keescook@chromium.org> From: John Johansen Message-ID: Date: Mon, 1 Oct 2018 14:14:19 -0700 MIME-Version: 1.0 In-Reply-To: <20180925001832.18322-10-keescook@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Kees Cook , James Morris Cc: Casey Schaufler , 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: <20181001211419.rFH5TGWp53XhMlfirKDVwHlbCNmeHkOZSIOEA8CbRwA@z> On 09/24/2018 05:18 PM, Kees Cook wrote: > Booting with "lsm.debug" will report future details on how LSM ordering > decisions are being made. > > Signed-off-by: Kees Cook Reviewed-by: John Johansen > --- > .../admin-guide/kernel-parameters.txt | 2 ++ > security/security.c | 18 ++++++++++++++++++ > 2 files changed, 20 insertions(+) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 9871e649ffef..32d323ee9218 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -2274,6 +2274,8 @@ > ltpc= [NET] > Format: ,, > > + lsm.debug [SECURITY] Enable LSM initialization debugging output. > + > machvec= [IA-64] Force the use of a particular machine-vector > (machvec) in a generic kernel. > Example: machvec=hpzx1_swiotlb > diff --git a/security/security.c b/security/security.c > index e74f46fba591..ee49b921d750 100644 > --- a/security/security.c > +++ b/security/security.c > @@ -12,6 +12,8 @@ > * (at your option) any later version. > */ > > +#define pr_fmt(fmt) "LSM: " fmt > + > #include > #include > #include > @@ -43,11 +45,19 @@ char *lsm_names; > static __initdata char chosen_lsm[SECURITY_NAME_MAX + 1] = > CONFIG_DEFAULT_SECURITY; > > +static bool debug __initdata; > +#define init_debug(...) \ > + do { \ > + if (debug) \ > + pr_info(__VA_ARGS__); \ > + } while (0) > + > static void __init major_lsm_init(void) > { > struct lsm_info *lsm; > > for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) { > + init_debug("initializing %s\n", lsm->name); > lsm->init(); > } > } > @@ -91,6 +101,14 @@ static int __init choose_lsm(char *str) > } > __setup("security=", choose_lsm); > > +/* Enable LSM order debugging. */ > +static int __init enable_debug(char *str) > +{ > + debug = true; > + return 1; > +} > +__setup("lsm.debug", enable_debug); > + > static bool match_last_lsm(const char *list, const char *lsm) > { > const char *last; >