chiark / gitweb /
[PATCH] udev selinux fix
authorpebenito@gentoo.org <pebenito@gentoo.org>
Tue, 8 Mar 2005 14:57:25 +0000 (06:57 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:39:48 +0000 (23:39 -0700)
commitb55e6540260ac3e38d96a0b6c00514a72d5db218
treee5ccd55a113138047deabf65824c6f8711e175ff
parente5f053b5312a0f8d62a2bcff8ddb095052d228bc
[PATCH] udev selinux fix

Here is a fix for the SELinux part of udev.

Setfscreatecon() overrides the default labeling behavior of SELinux when
creating files, so it should only be used for as short of a time as
possible, around the mknod or symlink calls.  Without this, the files in
udev_db get the wrong label because the fscreatecon is reset after the
udev_db file creation instead of before.  I'm guessing the Redhat people
missed this because they modify udev_db to be one big file instead of a
directory of small files (at least that's what I'm told).  I created
selinux_resetfscreatecon() to reset the fscreatecon asap after the
file/node is created.

Fixed a memory leak in selinux_init.  Getfscreatecon() allocates memory
for the context, and the udev code was immediately setting the pointer
(security_context_t is actually a typedef'ed char*) to NULL after the
call regardless of success/failure.  If you're wondering about the case
where there's effectively a setfscreatecon(NULL), this is ok, as its
used to tell SELinux to do the default labeling behavior.

Renamed selinux_restore() to selinux_exit() due to the changed behavior.

Fixed a couple of dbg() messages.
udev_add.c
udev_selinux.c
udev_selinux.h