Skip to contentSkip to conversation

security: selinux: allow per-file labelling for binderfs

PATCH Applied Hridya Valsaraju 3 participants 6 messages Jan 6, 2020 – Jan 7, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 security: selinux: allow per-file labelling for binderfs

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

---
 security/selinux/hooks.c | 1 +
 1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
index 116b4d644f68..3f0669a708e9 100644
@@ -752,6 +752,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
 	if (!strcmp(sb->s_type->name, "debugfs") ||
 	    !strcmp(sb->s_type->name, "tracefs") ||
+	    !strcmp(sb->s_type->name, "binderfs") ||
 	    !strcmp(sb->s_type->name, "pstore"))
 		sbsec->flags |= SE_SBGENFS;
 
Signature · 1 line
2.24.1.735.g03f4e72817-goog
#1 lore raw
Quoted 8 lines · Hridya Valsaraju

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

Do you want binderfs to also support userspace labeling of files via setxattr()? If so, you'll want to also add it to selinux_is_genfs_special_handling() as well.

Quoted 17 lines
---
  security/selinux/hooks.c | 1 +
  1 file changed, 1 insertion(+)
security/selinux/hooks.c +1 -0
index 116b4d644f68..3f0669a708e9 100644
@@ -752,6 +752,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
  	if (!strcmp(sb->s_type->name, "debugfs") ||
  	    !strcmp(sb->s_type->name, "tracefs") ||
+	    !strcmp(sb->s_type->name, "binderfs") ||
  	    !strcmp(sb->s_type->name, "pstore"))
  		sbsec->flags |= SE_SBGENFS;
 
#2 lore raw
Quoted 7 lines · Stephen Smalley' via kernel-team
Quoted 5 lines · Hridya Valsaraju

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

Quoted 7 lines
Quoted 3 lines

Do you want binderfs to also support userspace labeling of files via setxattr()? If so, you'll want to also add it to selinux_is_genfs_special_handling() as well.

Thank you for the quick response Stephen :) I cannot think of a use-case for the userspace labelling of files in binderfs via setxattr() as of now. I
will make the change if one comes up!

Thanks,
Hridya

Quoted 22 lines
Quoted 11 lines
---
  security/selinux/hooks.c | 1 +
  1 file changed, 1 insertion(+)
security/selinux/hooks.c +0 -0
index 116b4d644f68..3f0669a708e9 100644

security/selinux/hooks.c static int selinux_set_mnt_opts(struct super_block *sb, · line 758

Quoted 7 lines
security/selinux/hooks.c +1 -0
@@ -752,6 +752,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
      if (!strcmp(sb->s_type->name, "debugfs") ||
          !strcmp(sb->s_type->name, "tracefs") ||
+         !strcmp(sb->s_type->name, "binderfs") ||
          !strcmp(sb->s_type->name, "pstore"))
              sbsec->flags |= SE_SBGENFS;
 

--
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

#3 lore raw
Quoted 13 lines · Hridya Valsaraju
Quoted 11 lines · Stephen Smalley' via kernel-team
Quoted 8 lines · Hridya Valsaraju

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

Quoted 8 lines
Quoted 3 lines

Do you want binderfs to also support userspace labeling of files via setxattr()? If so, you'll want to also add it to selinux_is_genfs_special_handling() as well.

Thank you for the quick response Stephen :) I cannot think of a use-case for the userspace labelling of files in binderfs via setxattr() as of now. I
will make the change if one comes up!

Ok, then you can include my:

Quoted 27 lines

Thanks,
Hridya

Quoted 22 lines
Quoted 11 lines
---
   security/selinux/hooks.c | 1 +
   1 file changed, 1 insertion(+)
security/selinux/hooks.c +0 -0
index 116b4d644f68..3f0669a708e9 100644

security/selinux/hooks.c static int selinux_set_mnt_opts(struct super_block *sb, · line 758

Quoted 7 lines
security/selinux/hooks.c +1 -0
@@ -752,6 +752,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
       if (!strcmp(sb->s_type->name, "debugfs") ||
           !strcmp(sb->s_type->name, "tracefs") ||
+         !strcmp(sb->s_type->name, "binderfs") ||
           !strcmp(sb->s_type->name, "pstore"))
               sbsec->flags |= SE_SBGENFS;
 

--
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

#4 lore raw
Quoted 19 lines · Stephen Smalley
Quoted 17 lines · Hridya Valsaraju
Quoted 14 lines · Stephen Smalley' via kernel-team
Quoted 8 lines · Hridya Valsaraju

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

Do you want binderfs to also support userspace labeling of files via setxattr()? If so, you'll want to also add it to selinux_is_genfs_special_handling() as well.

Quoted 7 lines
Quoted 4 lines

Thank you for the quick response Stephen :) I cannot think of a use-case for the userspace labelling of files in binderfs via setxattr() as of now. I
will make the change if one comes up!

Ok, then you can include my:

Great! Thank you for reviewing my patch Stephen!

Regards,
Hridya

Quoted 29 lines
Quoted 28 lines

Thanks,
Hridya

Quoted 22 lines
Quoted 11 lines
---
   security/selinux/hooks.c | 1 +
   1 file changed, 1 insertion(+)
security/selinux/hooks.c +0 -0
index 116b4d644f68..3f0669a708e9 100644

security/selinux/hooks.c static int selinux_set_mnt_opts(struct super_block *sb, · line 758

Quoted 7 lines
security/selinux/hooks.c +1 -0
@@ -752,6 +752,7 @@ static int selinux_set_mnt_opts(struct super_block *sb,
 
       if (!strcmp(sb->s_type->name, "debugfs") ||
           !strcmp(sb->s_type->name, "tracefs") ||
+         !strcmp(sb->s_type->name, "binderfs") ||
           !strcmp(sb->s_type->name, "pstore"))
               sbsec->flags |= SE_SBGENFS;
 

--
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

maintainer Applied
#5 lore raw
In reply to Stephen Smalley
Quoted 18 lines · Stephen Smalley
Quoted 17 lines · Hridya Valsaraju
Quoted 14 lines · Stephen Smalley' via kernel-team
Quoted 8 lines · Hridya Valsaraju

This patch allows genfscon per-file labeling for binderfs. This is required to have separate permissions to allow access to binder, hwbinder and vndbinder devices which are relocating to binderfs.

Do you want binderfs to also support userspace labeling of files via setxattr()? If so, you'll want to also add it to selinux_is_genfs_special_handling() as well.

Quoted 7 lines
Quoted 4 lines

Thank you for the quick response Stephen :) I cannot think of a use-case for the userspace labelling of files in binderfs via setxattr() as of now. I
will make the change if one comes up!

Ok, then you can include my:

Merged into selinux/next, thanks everyone!

Signature · 2 lines
paul moore
www.paul-moore.com