From: Stephen Smalley <sds@tycho.nsa.gov> To: Sebastien Buisson <sbuisson.ddn@gmail.com>, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, selinux@tycho.nsa.gov Cc: william.c.roberts@intel.com, serge@hallyn.com, james.l.morris@oracle.com, eparis@parisplace.org, paul@paul-moore.com, Sebastien Buisson <sbuisson@ddn.com> Subject: Re: [PATCH] selinux: add selinux_is_enforced() function Date: Wed, 12 Apr 2017 08:13:22 -0400 [thread overview] Message-ID: <1491999202.3881.3.camel@tycho.nsa.gov> (raw) In-Reply-To: <1491988018-4120-1-git-send-email-sbuisson@ddn.com> On Wed, 2017-04-12 at 18:06 +0900, Sebastien Buisson wrote: > Add selinux_is_enforced() function to give access to SELinux > enforcement to the rest of the kernel. > > Signed-off-by: Sebastien Buisson <sbuisson@ddn.com> > --- > include/linux/selinux.h | 5 +++++ > security/selinux/exports.c | 6 ++++++ > security/selinux/hooks.c | 2 ++ > security/selinux/include/avc.h | 6 ------ > security/selinux/include/security.h | 1 + > 5 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/include/linux/selinux.h b/include/linux/selinux.h > index 44f4596..1007321 100644 > --- a/include/linux/selinux.h > +++ b/include/linux/selinux.h > @@ -24,12 +24,17 @@ > * selinux_is_enabled - is SELinux enabled? > */ > bool selinux_is_enabled(void); > +bool selinux_is_enforced(void); > #else > > static inline bool selinux_is_enabled(void) > { > return false; > } > +static inline bool selinux_is_enforced(void) > +{ > + return false; > +} > #endif /* CONFIG_SECURITY_SELINUX */ > > #endif /* _LINUX_SELINUX_H */ > diff --git a/security/selinux/exports.c b/security/selinux/exports.c > index e75dd94..016f1e2 100644 > --- a/security/selinux/exports.c > +++ b/security/selinux/exports.c > @@ -21,3 +21,9 @@ bool selinux_is_enabled(void) > return selinux_enabled; > } > EXPORT_SYMBOL_GPL(selinux_is_enabled); > + > +bool selinux_is_enforced(void) > +{ > + return selinux_enforcing; > +} > +EXPORT_SYMBOL_GPL(selinux_is_enforced); > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index e67a526..da2baeb 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -109,6 +109,8 @@ static int __init enforcing_setup(char *str) > return 1; > } > __setup("enforcing=", enforcing_setup); > +#else > +int selinux_enforcing; > #endif > > #ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM > diff --git a/security/selinux/include/avc.h > b/security/selinux/include/avc.h > index 0999df0..ff98351 100644 > --- a/security/selinux/include/avc.h > +++ b/security/selinux/include/avc.h > @@ -19,12 +19,6 @@ > #include "av_permissions.h" > #include "security.h" > > -#ifdef CONFIG_SECURITY_SELINUX_DEVELOP > -extern int selinux_enforcing; > -#else > -#define selinux_enforcing 1 > -#endif If CONFIG_SECURITY_SELINUX_DEVELOP=n, then selinux_enforcing is supposed to always be 1, i.e. global permissive mode is not supported. Your patch breaks that. That's in addition to the points raised by others about needing an in-tree user and use of a LSM hook interface instead. > - > /* > * An entry in the AVC. > */ > diff --git a/security/selinux/include/security.h > b/security/selinux/include/security.h > index f979c35..1e67e268 100644 > --- a/security/selinux/include/security.h > +++ b/security/selinux/include/security.h > @@ -64,6 +64,7 @@ > struct netlbl_lsm_secattr; > > extern int selinux_enabled; > +extern int selinux_enforcing; > > /* Policy capabilities */ > enum {
WARNING: multiple messages have this Message-ID (diff)
From: sds@tycho.nsa.gov (Stephen Smalley) To: linux-security-module@vger.kernel.org Subject: [PATCH] selinux: add selinux_is_enforced() function Date: Wed, 12 Apr 2017 08:13:22 -0400 [thread overview] Message-ID: <1491999202.3881.3.camel@tycho.nsa.gov> (raw) In-Reply-To: <1491988018-4120-1-git-send-email-sbuisson@ddn.com> On Wed, 2017-04-12 at 18:06 +0900, Sebastien Buisson wrote: > Add selinux_is_enforced() function to give access to SELinux > enforcement to the rest of the kernel. > > Signed-off-by: Sebastien Buisson <sbuisson@ddn.com> > --- > ?include/linux/selinux.h?????????????| 5 +++++ > ?security/selinux/exports.c??????????| 6 ++++++ > ?security/selinux/hooks.c????????????| 2 ++ > ?security/selinux/include/avc.h??????| 6 ------ > ?security/selinux/include/security.h | 1 + > ?5 files changed, 14 insertions(+), 6 deletions(-) > > diff --git a/include/linux/selinux.h b/include/linux/selinux.h > index 44f4596..1007321 100644 > --- a/include/linux/selinux.h > +++ b/include/linux/selinux.h > @@ -24,12 +24,17 @@ > ? * selinux_is_enabled - is SELinux enabled? > ? */ > ?bool selinux_is_enabled(void); > +bool selinux_is_enforced(void); > ?#else > ? > ?static inline bool selinux_is_enabled(void) > ?{ > ? return false; > ?} > +static inline bool selinux_is_enforced(void) > +{ > + return false; > +} > ?#endif /* CONFIG_SECURITY_SELINUX */ > ? > ?#endif /* _LINUX_SELINUX_H */ > diff --git a/security/selinux/exports.c b/security/selinux/exports.c > index e75dd94..016f1e2 100644 > --- a/security/selinux/exports.c > +++ b/security/selinux/exports.c > @@ -21,3 +21,9 @@ bool selinux_is_enabled(void) > ? return selinux_enabled; > ?} > ?EXPORT_SYMBOL_GPL(selinux_is_enabled); > + > +bool selinux_is_enforced(void) > +{ > + return selinux_enforcing; > +} > +EXPORT_SYMBOL_GPL(selinux_is_enforced); > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c > index e67a526..da2baeb 100644 > --- a/security/selinux/hooks.c > +++ b/security/selinux/hooks.c > @@ -109,6 +109,8 @@ static int __init enforcing_setup(char *str) > ? return 1; > ?} > ?__setup("enforcing=", enforcing_setup); > +#else > +int selinux_enforcing; > ?#endif > ? > ?#ifdef CONFIG_SECURITY_SELINUX_BOOTPARAM > diff --git a/security/selinux/include/avc.h > b/security/selinux/include/avc.h > index 0999df0..ff98351 100644 > --- a/security/selinux/include/avc.h > +++ b/security/selinux/include/avc.h > @@ -19,12 +19,6 @@ > ?#include "av_permissions.h" > ?#include "security.h" > ? > -#ifdef CONFIG_SECURITY_SELINUX_DEVELOP > -extern int selinux_enforcing; > -#else > -#define selinux_enforcing 1 > -#endif If CONFIG_SECURITY_SELINUX_DEVELOP=n, then selinux_enforcing is supposed to always be 1, i.e. global permissive mode is not supported. Your patch breaks that. That's in addition to the points raised by others about needing an in-tree user and use of a LSM hook interface instead. > - > ?/* > ? * An entry in the AVC. > ? */ > diff --git a/security/selinux/include/security.h > b/security/selinux/include/security.h > index f979c35..1e67e268 100644 > --- a/security/selinux/include/security.h > +++ b/security/selinux/include/security.h > @@ -64,6 +64,7 @@ > ?struct netlbl_lsm_secattr; > ? > ?extern int selinux_enabled; > +extern int selinux_enforcing; > ? > ?/* Policy capabilities */ > ?enum { -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-04-12 12:09 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-12 9:06 [PATCH] selinux: add selinux_is_enforced() function Sebastien Buisson 2017-04-12 9:06 ` Sebastien Buisson 2017-04-12 11:55 ` Paul Moore 2017-04-12 11:55 ` Paul Moore 2017-04-12 13:30 ` Sebastien Buisson 2017-04-12 13:30 ` Sebastien Buisson 2017-04-12 13:58 ` Stephen Smalley 2017-04-12 13:58 ` Stephen Smalley 2017-04-12 15:19 ` Sebastien Buisson 2017-04-12 15:19 ` Sebastien Buisson 2017-04-12 16:33 ` Stephen Smalley 2017-04-12 16:33 ` Stephen Smalley 2017-04-13 0:12 ` Casey Schaufler 2017-04-13 0:12 ` Casey Schaufler 2017-04-12 13:30 ` Sebastien Buisson 2017-04-12 13:30 ` Sebastien Buisson 2017-04-12 14:35 ` Stephen Smalley 2017-04-12 14:35 ` Stephen Smalley 2017-04-12 15:11 ` Sebastien Buisson 2017-04-12 15:11 ` Sebastien Buisson 2017-04-12 16:24 ` Stephen Smalley 2017-04-12 16:24 ` Stephen Smalley 2017-04-12 17:07 ` Sebastien Buisson 2017-04-12 17:07 ` Sebastien Buisson 2017-04-12 17:24 ` Stephen Smalley 2017-04-12 17:24 ` Stephen Smalley 2017-04-12 12:13 ` Stephen Smalley [this message] 2017-04-12 12:13 ` Stephen Smalley
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1491999202.3881.3.camel@tycho.nsa.gov \ --to=sds@tycho.nsa.gov \ --cc=eparis@parisplace.org \ --cc=james.l.morris@oracle.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ --cc=paul@paul-moore.com \ --cc=sbuisson.ddn@gmail.com \ --cc=sbuisson@ddn.com \ --cc=selinux@tycho.nsa.gov \ --cc=serge@hallyn.com \ --cc=william.c.roberts@intel.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.