SELinux Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] security: selinux: allow per-file labeling for bpffs
@ 2020-02-06 21:14 Steven Moreland
  2020-02-07 15:49 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Moreland @ 2020-02-06 21:14 UTC (permalink / raw)
  To: paul, sds, eparis, keescook, anton, ccross, tony.luck, selinux,
	linux-kernel, kernel-team
  Cc: Connor O'Brien, Steven Moreland

From: Connor O'Brien <connoro@google.com>

Add support for genfscon per-file labeling of bpffs files. This allows
for separate permissions for different pinned bpf objects, which may
be completely unrelated to each other.

Signed-off-by: Connor O'Brien <connoro@google.com>
Signed-off-by: Steven Moreland <smoreland@google.com>
---
 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 116b4d644f68..d7b11188dc8d 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -750,7 +750,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 	if (strcmp(sb->s_type->name, "proc") == 0)
 		sbsec->flags |= SE_SBPROC | SE_SBGENFS;
 
-	if (!strcmp(sb->s_type->name, "debugfs") ||
+	if (!strcmp(sb->s_type->name, "bpf") ||
+	    !strcmp(sb->s_type->name, "debugfs") ||
 	    !strcmp(sb->s_type->name, "tracefs") ||
 	    !strcmp(sb->s_type->name, "pstore"))
 		sbsec->flags |= SE_SBGENFS;
-- 
2.25.0.341.g760bfbb309-goog

v1 -> v2
- Rebased to be on upstream selinux tree
- Removed Android specific 'Change-Id'


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] security: selinux: allow per-file labeling for bpffs
  2020-02-06 21:14 [PATCH v2] security: selinux: allow per-file labeling for bpffs Steven Moreland
@ 2020-02-07 15:49 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2020-02-07 15:49 UTC (permalink / raw)
  To: Steven Moreland, paul, eparis, keescook, anton, ccross,
	tony.luck, selinux, linux-kernel, kernel-team
  Cc: Connor O'Brien

On 2/6/20 4:14 PM, Steven Moreland wrote:
> From: Connor O'Brien <connoro@google.com>
> 
> Add support for genfscon per-file labeling of bpffs files. This allows
> for separate permissions for different pinned bpf objects, which may
> be completely unrelated to each other.
> 
> Signed-off-by: Connor O'Brien <connoro@google.com>
> Signed-off-by: Steven Moreland <smoreland@google.com>

Is this relative to the next branch of the selinux git tree?
Doesn't apply for me.

> ---
>   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 116b4d644f68..d7b11188dc8d 100644
> --- a/security/selinux/hooks.c
> +++ b/security/selinux/hooks.c
> @@ -750,7 +750,8 @@ static int selinux_set_mnt_opts(struct super_block *sb,
>   	if (strcmp(sb->s_type->name, "proc") == 0)
>   		sbsec->flags |= SE_SBPROC | SE_SBGENFS;
>   
> -	if (!strcmp(sb->s_type->name, "debugfs") ||
> +	if (!strcmp(sb->s_type->name, "bpf") ||
> +	    !strcmp(sb->s_type->name, "debugfs") ||
>   	    !strcmp(sb->s_type->name, "tracefs") ||
>   	    !strcmp(sb->s_type->name, "pstore"))
>   		sbsec->flags |= SE_SBGENFS;
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 21:14 [PATCH v2] security: selinux: allow per-file labeling for bpffs Steven Moreland
2020-02-07 15:49 ` Stephen Smalley

SELinux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/selinux/0 selinux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux selinux/ https://lore.kernel.org/selinux \
		selinux@vger.kernel.org
	public-inbox-index selinux

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git