linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Restoring permissions on existing nodes
@ 2007-12-03 12:13 Martin Orr
  2007-12-03 16:44 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Orr @ 2007-12-03 12:13 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1: Type: text/plain, Size: 624 bytes --]

Is there a reason why udev sets the permissions and SELinux context every
time it finds an existing node or symlink?

The code in question is (from udev_node.c):

in udev_node_mknod():
if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) {
	info("preserve file '%s', because it has correct dev_t", file);
	selinux_setfilecon(file, udev->dev->kernel, stats.st_mode);
	goto perms;
}

in node_symlink():
if (strcmp(target, buf) == 0) {
	info("preserve already existing symlink '%s' to '%s'", slink, target);
	selinux_setfilecon(slink, NULL, S_IFLNK);
	goto exit;
}

-- 
Martin Orr


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

[-- Attachment #2: Type: text/plain, Size: 309 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

[-- Attachment #3: Type: text/plain, Size: 226 bytes --]

_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Restoring permissions on existing nodes
  2007-12-03 12:13 Restoring permissions on existing nodes Martin Orr
@ 2007-12-03 16:44 ` Kay Sievers
  0 siblings, 0 replies; 2+ messages in thread
From: Kay Sievers @ 2007-12-03 16:44 UTC (permalink / raw)
  To: linux-hotplug

On Dec 3, 2007 1:13 PM, Martin Orr <martin@martinorr.name> wrote:
> Is there a reason why udev sets the permissions and SELinux context every
> time it finds an existing node or symlink?
>
> The code in question is (from udev_node.c):
>
> in udev_node_mknod():
> if ((stats.st_mode & S_IFMT) = (mode & S_IFMT) && (stats.st_rdev = devt)) {
>         info("preserve file '%s', because it has correct dev_t", file);
>         selinux_setfilecon(file, udev->dev->kernel, stats.st_mode);
>         goto perms;
> }
>
> in node_symlink():
> if (strcmp(target, buf) = 0) {
>         info("preserve already existing symlink '%s' to '%s'", slink, target);
>         selinux_setfilecon(slink, NULL, S_IFLNK);
>         goto exit;
> }

Because it should match what the configuration specifies, you
can't expect that the properties of a pre-existing node are correct.
The node does not get replaced, because it should not change the inode
number, but all other properties get re-applied with the configured
values or the built-in default.

Kay

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-03 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-03 12:13 Restoring permissions on existing nodes Martin Orr
2007-12-03 16:44 ` Kay Sievers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).