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: Fri, 12 Sep 2014 14:14:19 -0400 [thread overview]
Message-ID: <541337FB.9050408@tresys.com> (raw)
In-Reply-To: <5400FE18.4040502@m4x.org>
On 8/29/2014 6:26 PM, Nicolas Iooss wrote:
> Le 26/08/2014 16:53, Dominick Grift a ?crit :
>> On Tue, Aug 26, 2014 at 08:20:36AM -0400, Christopher J. PeBenito wrote:
>>> On 8/23/2014 7:35 AM, Nicolas Iooss wrote:
>>>
>>> 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).
>>>
>>
>> In my experience, a way to see if something should be classified mountpoint (or whether some directory should maybe not be labeled with a filesystem type)
>> is look for AVC denials like this:
>>
>> avc: denied { write } for pid=674 comm="mount" name="/" dev="debugfs" ino=1 scontext=system_u:system_r:mount_t tcontext=system_u:object_r:debugfs_t tclass=dir permissive=0
>>
>> The mount command checks mountpoint file directories for write access
>>
>
> Tonight I read the output of "dmesg" and found this (which was not in
> audit.log):
>
> # dmesg |grep configfs
> [ 2.328208] SELinux: initialized (dev configfs, type configfs),
> uses genfs_contexts
> [ 2.328258] audit: type=1400 audit(1409327503.834:3): avc:
> denied { write } for pid=166 comm="mount" name="/" dev="configfs"
> ino=1633 scontext=system_u:system_r:mount_t
> tcontext=system_u:object_r:configfs_t tclass=dir permissive=1
>
> # ls -diZ /sys/kernel/config
> 1633 system_u:object_r:configfs_t /sys/kernel/config
>
> However the real mountpoint directory is still sysfs_t:
>
> # mkdir /sys2
> # mount --bind /sys /sys2
> # ls -idZ /sys2/kernel/config /sys/kernel/config
> 10884 system_u:object_r:sysfs_t /sys2/kernel/config
> 1633 system_u:object_r:configfs_t /sys/kernel/config
>
> Moreover /sys/kernel/config is almost empty and is not used for
> sub-mountpoints:
>
> # find /sys/kernel/config -exec ls -idZ {} \;
> 1633 system_u:object_r:configfs_t /sys/kernel/config
> 374658 system_u:object_r:configfs_t /sys/kernel/config/netconsole
>
> So I don't understand why configfs_t would be "mountpoint", even if the
> "write symptom" is here.
>
>
> Finally, my policy (which is refpolicy + approx. 100 patches) contains:
>
> # sesearch --dontaudit -s mount_t -c dir -p write
> Found 6 semantic av rules:
> dontaudit mount_t devpts_t : dir { ioctl read write create
> getattr setattr lock unlink link rename add_name remove_name
> reparent search rmdir open } ;
> dontaudit mount_t proc_t : dir write ;
> dontaudit mount_t sysfs_t : dir { write getattr search open } ;
> dontaudit mount_t tmpfs_t : dir write ;
> dontaudit mount_t debugfs_t : dir write ;
> dontaudit mount_t mountpoint : dir { write setattr } ;
>
> The penultimate line is quite surprising. It comes from this line in
> the refpolicy [1]:
>
> kernel_dontaudit_write_debugfs_dirs(mount_t)
>
> ... which leads to commit a861c7c6fd90 ("dontaudit mount writes to newly
> mounted filesystems") [2].
>
> Is it acceptable to create kernel_dontaudit_write_configfs_dirs
> interface and to use it for mount_t?
That would be fine. What might make sense instead is make a pseudo
filesystem attribute and dontaudit mount_t dir:write on it.
--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
next prev parent reply other threads:[~2014-09-12 18:14 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
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 [this message]
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=541337FB.9050408@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.