From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthias Schwarzott Date: Wed, 18 Mar 2009 20:37:59 +0000 Subject: Re: udev-140 Bug: udevadm test changing mode of /dev to 660, so making /dev unusuable for users Message-Id: <200903182138.00338.zzam@gentoo.org> MIME-Version: 1 Content-Type: multipart/mixed; boundary="Boundary-00=_ouVwJl3YMc+mgvD" List-Id: References: <200903181121.48924.zzam@gentoo.org> In-Reply-To: <200903181121.48924.zzam@gentoo.org> To: linux-hotplug@vger.kernel.org --Boundary-00=_ouVwJl3YMc+mgvD Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Mittwoch, 18. M=C3=A4rz 2009, Kay Sievers wrote: > On Wed, Mar 18, 2009 at 16:00, Matthias Schwarzott wrot= e: > > On Mittwoch, 18. M=C3=A4rz 2009, Matthias Schwarzott wrote: > >> This time I have a very strange error. I tried what happens when using > >> # udevadm test /sys/class/mem/null > >> > >> and strange, a bit later some user processes had problems accessing > >> /dev/null. A quick check showed, that the permissions of /dev were > >> destroyed. > >> > >> # ls -ld /dev /dev/null > >> drw-rw---- 16 root root 4280 18. M=C3=A4r 11:14 /dev > >> crw-rw-rw- =C2=A01 root root 1, 3 17. M=C3=A4r 08:05 /dev/null > > > > I found out how the error occurs: > > It is a difference between > > A. udevadm test /sys/class/mem/null/ > > and > > B. udevadm test /sys/class/mem/null > > > > Case A was the case that showed the error behaviour. It seems udevadm is > > confused by the trailing slash. This behaviour seems to be there since > > ages. > > Should be fixed now. > Works fine, thanks for the quick fix. Still I can easily find more ways to fool udevadm test going wrong. # udevadm test /sys/class/mem/null/./ =46ail in the same way. udev_event_execute_rules: no node name set, will use kernel name '.' Maybe it helps to make the node creation abort in case of rename failure,=20 patch attached. But I have no real understanding of all codepathes there, s= o=20 maybe this solution is not possible/correct. Regards Matthias --Boundary-00=_ouVwJl3YMc+mgvD Content-Type: text/x-diff; charset="iso 8859-15"; name="udev-140-abort-node-creation-on-rename-failure.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="udev-140-abort-node-creation-on-rename-failure.patch" diff --git a/udev/udev-node.c b/udev/udev-node.c index 74ec00b..92a680d 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -106,6 +106,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod if (err != 0) { err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); unlink(file_tmp); + goto exit; } } } else { --Boundary-00=_ouVwJl3YMc+mgvD--