new kernel patch
Quoted 3 lines
The new version seems to have a bug related to file labelling that affects devfs.
<snip>
Quoted 5 lines
You can see the log entry below, it does not log the action, and it claims that there is a file named
/dev/floppywhich is bogus. There can be no file under /dev on a devfs system so any reference to tclass=file and dev=00:06 means a kernel bug. Without reading the kernel code in question I guess that file is the default tclass (defined to 0?).
<snip>
Quoted 1 line
avc: denied { } for pid=65 exe=/sbin/devfsd path=/floppy dev=00:06 ino=527
scontext=system_u:system_r:devfsd_t tcontext=system_u:object_r:unlabeled_t tclass=file
When an inode is allocated, its SID is initialized to the unlabeled initial SID (=> system_u:object_r:unlabeled_t), and its security class is initialized to the file class by default. This log message indicates that a devfs inode reached a permission check without first being initialized by inode_doinit, likely due to a race between selinux_inode_post_lookup and a cached lookup. The empty permission set is due to an inability to map the requested permission (likely search) to a permission in the file class.
As a short term fix, I'd suggest the attached patch. A proper fix requires adjusting the inode_init call in d_instantiate and the SELinux hook function to properly handle filesystems that rely on genfs_contexts.
--
Stephen Smalley, NSA
[email protected]
Index: lsm-2.4/security/selinux/hooks.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/hooks.c,v retrieving revision 1.23
security/selinux/hooks.c +2 -0
@@ -2033,6 +2033,8 @@return 0 ; } +inode_doinit (inode); +return inode_has_perm (current, inode,file_mask_to_av (inode->i_mode, mask),NULL ,NULL ); }
Quoted 9 lines · Stephen D. Smalley
When an inode is allocated, its SID is initialized to the unlabeled initial SID (=> system_u:object_r:unlabeled_t), and its security class is initialized to the file class by default. This log message indicates that a devfs inode reached a permission check without first being initialized by
inode_doinit, likely due to a race betweenselinux_inode_post_lookupand a cached lookup. The empty permission set is due to an inability to map the requested permission (likely search) to a permission in the file class.
Quoted 3 lines
As a short term fix, I'd suggest the attached patch. A proper fix requires adjusting the
inode_initcall ind_instantiateand the SELinux hook function to properly handle filesystems that rely ongenfs_contexts.
This works. I'll add it to my kernel-patch package for Debian.
Also I've updated my kernel-patch-2.5-lsm package to include your latest patch.
Signature · 10 lines
http://www.coker.com.au/selinux/ My NSA Security Enhanced Linux packages http://www.coker.com.au/bonnie++/ Bonnie++ hard drive benchmark http://www.coker.com.au/postal/ Postal SMTP/POP benchmark http://www.coker.com.au/~russell/ My home page -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.