All of lore.kernel.org
 help / color / mirror / Atom feed
From: cpebenito@tresys.com (Christopher J. PeBenito)
To: refpolicy@oss.tresys.com
Subject: [refpolicy] [PATCH 4/7] Add attribute file_type to pseudo filesystem types
Date: Tue, 26 Aug 2014 08:20:36 -0400	[thread overview]
Message-ID: <53FC7B94.3000001@tresys.com> (raw)
In-Reply-To: <1408793751-11289-5-git-send-email-nicolas.iooss@m4x.org>

On 8/23/2014 7:35 AM, Nicolas Iooss wrote:
> Files in /sys/kernel/config are labeled configfs_t so this type needs
> attribute "file_type".  Without this attribute, these denials happen
> when using collectd with "df" plugin (this plugin enumerate mountpoints
> and collect disk usage stats):
> 
>     avc:  denied  { getattr } for pid=872 comm="collectd"
>     path="/sys/kernel/config" dev="configfs" ino=10234
>     scontext=system_u:system_r:collectd_t
>     tcontext=system_u:object_r:configfs_t tclass=dir
> 
> As collectd.te already contains files_getattr_all_dirs(collectd_t),
> adding file_type to configfs_t is enough to allow this access.
> 
> Moreover, similar filesystems such as debugfs_t already has file_type:
> 
>     $ seinfo -xtdebugfs_t
>        debugfs_t
>           file_type
>           filesystem_type
>           non_security_file_type
>           mountpoint
>           non_auth_file_type
>     $ seinfo -xtconfigfs_t
>        configfs_t
>           filesystem_type
> 
> This is because kernel.te contains files_mountpoint(debugfs_t), which
> uses files_type(debugfs_t).
> 
> This patch adds files_type() to every pseudo filesystem type that
> doesn't have file_type yet.

I don't think debugfs_t is a good example.  Looking at the file
contexts, I don't see why it needs to be a mount point.  I also don't
think that these pseudo filesystems should be file types either since
they aren't regular files.  It seems like the best choice would be to
use fs_getattr_all_dirs(collectd_t).



> ---
>  policy/modules/kernel/filesystem.te | 11 +++++++++++
>  policy/modules/kernel/kernel.te     |  1 +
>  2 files changed, 12 insertions(+)
> 
> diff --git a/policy/modules/kernel/filesystem.te b/policy/modules/kernel/filesystem.te
> index cf04fb76dc66..083756999432 100644
> --- a/policy/modules/kernel/filesystem.te
> +++ b/policy/modules/kernel/filesystem.te
> @@ -58,6 +58,7 @@ genfscon anon_inodefs / gen_context(system_u:object_r:anon_inodefs_t,s0)
>  
>  type bdev_t;
>  fs_type(bdev_t)
> +files_type(bdev_t)
>  genfscon bdev / gen_context(system_u:object_r:bdev_t,s0)
>  
>  type binfmt_misc_fs_t;
> @@ -78,10 +79,12 @@ genfscon cgroup / gen_context(system_u:object_r:cgroup_t,s0)
>  
>  type configfs_t;
>  fs_type(configfs_t)
> +files_type(configfs_t)
>  genfscon configfs / gen_context(system_u:object_r:configfs_t,s0)
>  
>  type cpusetfs_t;
>  fs_type(cpusetfs_t)
> +files_type(cpusetfs_t)
>  allow cpusetfs_t self:filesystem associate;
>  genfscon cpuset / gen_context(system_u:object_r:cpusetfs_t,s0)
>  
> @@ -92,6 +95,7 @@ genfscon ecryptfs / gen_context(system_u:object_r:ecryptfs_t,s0)
>  
>  type futexfs_t;
>  fs_type(futexfs_t)
> +files_type(futexfs_t)
>  genfscon futexfs / gen_context(system_u:object_r:futexfs_t,s0)
>  
>  type hugetlbfs_t;
> @@ -102,29 +106,35 @@ fs_use_trans hugetlbfs gen_context(system_u:object_r:hugetlbfs_t,s0);
>  
>  type ibmasmfs_t;
>  fs_type(ibmasmfs_t)
> +files_type(ibmasmfs_t)
>  allow ibmasmfs_t self:filesystem associate;
>  genfscon ibmasmfs / gen_context(system_u:object_r:ibmasmfs_t,s0)
>  
>  type infinibandeventfs_t;
>  fs_type(infinibandeventfs_t)
> +files_type(infinibandeventfs_t)
>  allow infinibandeventfs_t self:filesystem associate;
>  genfscon infinibandeventfs / gen_context(system_u:object_r:infinibandeventfs_t,s0)
>  
>  type inotifyfs_t;
>  fs_type(inotifyfs_t)
> +files_type(inotifyfs_t)
>  genfscon inotifyfs / gen_context(system_u:object_r:inotifyfs_t,s0)
>  
>  type mvfs_t;
>  fs_noxattr_type(mvfs_t)
> +files_type(mvfs_t)
>  allow mvfs_t self:filesystem associate;
>  genfscon mvfs / gen_context(system_u:object_r:mvfs_t,s0)
>  
>  type nfsd_fs_t;
>  fs_type(nfsd_fs_t)
> +files_type(nfsd_fs_t)
>  genfscon nfsd / gen_context(system_u:object_r:nfsd_fs_t,s0)
>  
>  type oprofilefs_t;
>  fs_type(oprofilefs_t)
> +files_type(oprofilefs_t)
>  genfscon oprofilefs / gen_context(system_u:object_r:oprofilefs_t,s0)
>  
>  type pstore_t;
> @@ -140,6 +150,7 @@ genfscon ramfs / gen_context(system_u:object_r:ramfs_t,s0)
>  
>  type romfs_t;
>  fs_type(romfs_t)
> +files_type(romfs_t)
>  genfscon romfs / gen_context(system_u:object_r:romfs_t,s0)
>  genfscon cramfs / gen_context(system_u:object_r:romfs_t,s0)
>  
> diff --git a/policy/modules/kernel/kernel.te b/policy/modules/kernel/kernel.te
> index 3fc6a56d41f0..f6cd41b70135 100644
> --- a/policy/modules/kernel/kernel.te
> +++ b/policy/modules/kernel/kernel.te
> @@ -66,6 +66,7 @@ genfscon debugfs / gen_context(system_u:object_r:debugfs_t,s0)
>  #
>  
>  type kvmfs_t;
> +files_type(kvmfs_t)
>  fs_type(kvmfs_t)
>  genfscon kvmfs / gen_context(system_u:object_r:kvmfs_t,s0)
>  
> 

-- 
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

  reply	other threads:[~2014-08-26 12:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-23 11:35 [refpolicy] [PATCH 0/7] Set of small patches Nicolas Iooss
2014-08-23 11:35 ` [refpolicy] [PATCH 1/7] Label /usr/lib/networkmanager/ like /usr/lib/NetworkManager/ Nicolas Iooss
2014-08-26 13:15   ` Christopher J. PeBenito
2014-08-23 11:35 ` [refpolicy] [PATCH 2/7] Label /var/spool/postfix/dev/ files Nicolas Iooss
2014-08-25 15:04   ` Christopher J. PeBenito
2014-08-26 16:14     ` Nicolas Iooss
2014-09-17  8:00       ` Russell Coker
2014-08-23 11:35 ` [refpolicy] [PATCH 3/7] Fix typo in fs_getattr_all_fs description Nicolas Iooss
2014-08-26 13:15   ` Christopher J. PeBenito
2014-08-23 11:35 ` [refpolicy] [PATCH 4/7] Add attribute file_type to pseudo filesystem types Nicolas Iooss
2014-08-26 12:20   ` Christopher J. PeBenito [this message]
2014-08-26 14:53     ` Dominick Grift
2014-08-27 21:51       ` Nicolas Iooss
2014-08-28  7:06         ` Dominick Grift
2014-08-28  9:39           ` Dominick Grift
2014-08-29 22:26       ` Nicolas Iooss
2014-09-12 18:14         ` Christopher J. PeBenito
2014-08-23 11:35 ` [refpolicy] [PATCH 5/7] Add socket and dccp_socket to socket_class_set Nicolas Iooss
2014-08-25 15:07   ` Christopher J. PeBenito
2014-08-26 17:22     ` Nicolas Iooss
2014-08-27 17:41       ` Christopher J. PeBenito
2014-08-23 11:35 ` [refpolicy] [PATCH 6/7] Add ioctl and lock to manage_lnk_file_perms Nicolas Iooss
2014-08-26 13:15   ` Christopher J. PeBenito
2014-08-23 11:35 ` [refpolicy] [PATCH 7/7] Label (/var)?/tmp/systemd-private-.../tmp like /tmp Nicolas Iooss
2014-08-26 13:15   ` Christopher J. PeBenito

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=53FC7B94.3000001@tresys.com \
    --to=cpebenito@tresys.com \
    --cc=refpolicy@oss.tresys.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: 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.