Bug 62615

Summary: udev 198 labels files in /dev incorrectly on boot
Product: systemd Reporter: Amadeusz <amade>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: output of diff a b

Description Amadeusz 2013-03-21 21:30:02 UTC
Created attachment 76878 [details]
output of diff a b

udev 198 doesn't label files in /dev correctly, some of them have correct context while some do not.

ls -Z /dev > a
restorecon -R /dev
ls -Z /dev > b
diff a b

diff shows that a lot of files have wrong context


It seems to be caused by this commit:
http://cgit.freedesktop.org/systemd/systemd/commit/?id=22582bb2cbe85b40de5f561589e0468dac769515
in particular by two lines from it:
- if (strcmp(udev_device_get_action(dev), "add") == 0) {
+ if (apply) {

After replacing apply with strcmp, all files are labeled correctly again

apply is passed via function calls with initial call in src/udev/udev-event.c in function udev_event_execute_rules

udev_node_add(dev, event->owner_set || event->group_set || event->mode_set,
  event->mode, event->uid, event->gid);

event->owner_set || event->group_set || event->mode_set  evaluates to value of apply

"udev_node_add" then calls passing apply "node_permissions_apply" which has "if (apply) {" check

Reproducible: Always

( https://bugs.gentoo.org/show_bug.cgi?id=462538 )
Comment 1 Kay Sievers 2013-03-21 22:14:22 UTC
Mind giving this a try?

http://cgit.freedesktop.org/systemd/systemd/commit/?id=9a8ae49d91ae303c4f7c87f9c56fba3e8d646af7

Thanks!
Comment 2 Amadeusz 2013-03-21 22:33:39 UTC
Yes it works correctly now.
Comment 3 Kay Sievers 2013-03-21 22:37:34 UTC
Nice! Thanks a lot for the excellent report.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.