SELinux-Refpolicy Archive on
 help / color / Atom feed
From: Laurent Bigonville <>
To: Nicolas Iooss <>,
Subject: Re: Permissions in the udevadm_t domain
Date: Mon, 9 Sep 2019 11:18:51 +0200
Message-ID: <> (raw)
In-Reply-To: <>

On 7/09/19 15:14, Nicolas Iooss wrote:
> [Adding, which is better suited for
> questions related to refpolicy]
> On Sat, Sep 7, 2019 at 12:19 PM Laurent Bigonville <> wrote:
> [...]
>> But when
>> looking at the current policy code I'm seeing that udevadm is allowed to
>> delete files/directory/.. in /var/run and I'm wondering why. I've never
>> seen this happening during my (limited) test, an idea?
> Which policy? On my test system based on a lightly-patched refpolicy, I have:
> # sesearch -A -s udevadm_t -t var_run_t
> allow udevadm_t var_run_t:dir { getattr open search };
> allow udevadm_t var_run_t:lnk_file { getattr read };

It's the refpolicy, but I meant udev_var_run_t (/var/run/udev) rather 
than var_run_t

# sesearch -A -s udevadm_t -t udev_var_run_t
allow udevadm_t udev_var_run_t:dir { getattr ioctl lock open read 
remove_name rmdir search write };
allow udevadm_t udev_var_run_t:file { getattr unlink };
allow udevadm_t udev_var_run_t:lnk_file { getattr unlink };
allow udevadm_t udev_var_run_t:sock_file { append getattr open write };

>> For the later, it seems that the kernel the mode to 400 on some files in
>> /sys (ie. --w------- 1 root root 4096 sep  5 17:06
>> /sys/module/snd_hda_codec_generic/uevent) looking at the code it seems
>> that udev is ready to handle EACCES already, so I was wondering, should
>> we just allow dac_read_search or don't audit dac_read_search (and
>> dac_override as well then)?
> For the record, even with dac_read_search, opening this file fails
> with EACCES, because the kernel did not implement show() on this sysfs
> file (cf.
> and kernfs_fop_open() in fs/kernfs/file.c). More precisely, openat()
> returns EACCES because kernfs_fop_open() returns this error code when
> trying to open a write-only file for reading. Unfortunately this check
> happens after the capability checks, which is why you got the denials
> for dac_override and dac_read_search.
> I do not have an opinion about allowing dac_read_search vs.
> dontaudit-ing dac_read_search and dac_override.
Grift was saying that "the cap_dac_read_search could maybe be 
dontaudited, but then cap_dac_override would have to be dontaudited as 
well. cap_dac_read_search would also be triggered when you run `sudo 
udevadm ...` where pwd or/and oldpwd is ~"

So I guess I will just allow it

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <>
2019-09-07 13:14 ` Nicolas Iooss
2019-09-09  9:18   ` Laurent Bigonville [this message]

Reply instructions:

You may reply publically 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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

SELinux-Refpolicy Archive on

Archives are clonable:
	git clone --mirror selinux-refpolicy/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-refpolicy selinux-refpolicy/ \
	public-inbox-index selinux-refpolicy

Newsgroup available over NNTP:

AGPL code for this site: git clone public-inbox