Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 297317 - improper handling of seeded device nodes in udev-mount on SELinux systems
Summary: improper handling of seeded device nodes in udev-mount on SELinux systems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High major (vote)
Assignee: udev maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 322513
  Show dependency tree
 
Reported: 2009-12-17 19:53 UTC by Chris Richards
Modified: 2010-06-02 20:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge-info.txt,3.15 KB, text/plain)
2009-12-17 19:56 UTC, Chris Richards
Details
Modifications to /etc/init.d/udev-mount (udev-mount.diff,1.33 KB, patch)
2009-12-17 20:00 UTC, Chris Richards
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Richards 2009-12-17 19:53:13 UTC
During system startup, there are AVC denials attemtping to access /dev/null from both /etc/init.d/udev-mount and /etc/init.d/udev.  This is due to the SELinux context of this device not being properly set by the udev-mount init script.

Reproducible: Always

Steps to Reproduce:
1.Reboot system with SELinux in strict policy enforcing mode
2. Observe errors accessing /dev/null by udev-mount and udev
3.

Actual Results:  
On console, you will see errors similar to the following:
 *mounting /dev ...           [ok]
/etc/init.d/udev-mount: line 63: /dev/null: Permission denied
/etc/init.d/udev: line 69: /dev/null: Permission denied
 *starting udevd ...          [ok]

There will also be entries in /var/log/avc.log similar to the following:
Dec 17 19:47:10 aoaforums kernel: type=1400 audit(1261079213.444:6): avc:  denied  { write } for  pid=461 comm="bash" name="null" dev=tmpfs ino=1449 scontext=system_u:system_r:initrc_t tcontext=system_u:object_r:device_t tclass=chr_file


Expected Results:  
No AVC denials recorded in /var/log/avc.log and no errors shown on console.

This problem also affects the 20091215 policy.  I suspect that it also affects targeted policy, though I've not tested that.  It appears to be the result of not relabeling certain devices that are created in the init script before they are actually used.  I've attached a diff with the changes I made to /etc/init.d/udev-mount (at PeBenito's direction) to resolve this.

I've also attached my emerge --info
Comment 1 Chris Richards 2009-12-17 19:56:04 UTC
Created attachment 213319 [details]
emerge --info
Comment 2 Chris Richards 2009-12-17 20:00:16 UTC
Created attachment 213321 [details, diff]
Modifications to /etc/init.d/udev-mount
Comment 3 Chris PeBenito (RETIRED) gentoo-dev 2009-12-17 20:09:38 UTC
I want to clarify that this is not a SELinux policy problem.  Since the device nodes are created inside the udev-mount script instead of by udevd, the devices do not have correct SELinux labels until udevd starts and fills out /dev completely, which is a race condition.  In fact we currently always lose the race, since the script creates /dev/null, and then later in the script it does a redirection to /dev/null (which is before udevd starts).
Comment 4 Matthias Schwarzott gentoo-dev 2010-01-29 21:15:10 UTC
Added this change to udev-151.