All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Subject: [PATCH v2] selinux: enable genfscon labeling for securityfs
Date: Tue, 28 Sep 2021 17:39:31 +0200	[thread overview]
Message-ID: <20210928153931.9557-1-cgzones@googlemail.com> (raw)
In-Reply-To: <20210915162326.392808-1-cgzones@googlemail.com>

Add support for genfscon per-file labeling of securityfs files.  This allows
for separate labels and thereby access control for different files.
For example a genfscon statement

    genfscon securityfs /integrity/ima/policy system_u:object_r:ima_policy_t:s0

will set a private label to the IMA policy file and thus allow to
control the ability to set the IMA policy.
Setting labels directly with setxattr(2), e.g. by chcon(1) or
setfiles(8), is still not supported.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
v2:
  - improve commit description


 security/selinux/hooks.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 012e8504ed9e..549f631e9832 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -760,7 +760,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 	    !strcmp(sb->s_type->name, "tracefs") ||
 	    !strcmp(sb->s_type->name, "binder") ||
 	    !strcmp(sb->s_type->name, "bpf") ||
-	    !strcmp(sb->s_type->name, "pstore"))
+	    !strcmp(sb->s_type->name, "pstore") ||
+	    !strcmp(sb->s_type->name, "securityfs"))
 		sbsec->flags |= SE_SBGENFS;
 
 	if (!strcmp(sb->s_type->name, "sysfs") ||
-- 
2.33.0


  parent reply	other threads:[~2021-09-28 15:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-15 16:23 [PATCH] selinux: enable genfscon labeling for securityfs Christian Göttsche
2021-09-15 18:27 ` Paul Moore
2021-09-16 17:41   ` Christian Göttsche
2021-09-17  2:07     ` Paul Moore
2021-09-17  8:00       ` Christian Göttsche
2021-09-17 13:27         ` Stephen Smalley
2021-09-27 21:56       ` Paul Moore
2021-09-28 15:39 ` Christian Göttsche [this message]
2021-09-28 22:50   ` [PATCH v2] " Paul Moore

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=20210928153931.9557-1-cgzones@googlemail.com \
    --to=cgzones@googlemail.com \
    --cc=selinux@vger.kernel.org \
    /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: link
Be 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.