run_init patch
Here is a patch for policycoreutils (against 1.1) which closes the file descriptor in run_init on successfully getting the context out of /etc/security/initrc_context. It is closed on a failed read, but was missing on the successful read.
This prevents a denial similar to:
avc: denied { use } for pid=13041 exe=/usr/sbin/smbd path=/etc/security/initrc_context dev=03:03 ino=722489 scontext=system_u:system_r:smbd_t tcontext=pebenito:sysadm_r:run_init_t tclass=fd
Signature · 7 lines
Chris PeBenito <[email protected]> Developer, SELinux Hardened Gentoo Linux Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xE6AF9243 Key fingerprint = B0E6 877A 883F A57A 8E6A CB00 BC8E E42D E6AF 9243
run_init/run_init.c +1 -0
@@ -288,6 +288,7 @@ *context =strdup (bufp);if (!(*context)) goto out; +fclose (fp);return 0 ; } }