Created attachment 535982 [details] Enable fs_use_xattr for squashfs Description of problem: As I lack some disc space on my old eeepc, I'm trying to move my /usr folder on a compressed file system. A good candidate for this is squashfs. So, I just issued the following command: mksquashfs /usr /usr.sqsh And modified my /etc/fstab to mount /usr.sqsh on /usr on boot. The problem is that the current selinux policy for squashfs do not use the extended attributes stored in my compressed file, and of course, I get AVC alerts because all my /usr files get the default selinux context. My solution to this problem is to modify the selinux policy to use the extended attributes stored in the squash filesystem (see attached patch). I do not know if it can be used everywhere(like for livecd instead of a squash filesystem that contains and ext3 image), or if there is another option I can use at mount time.
So squashfs now supports extended attributes?
Looks like the kernel squashfs code supports listxattr/getxattr. So the only issue would be whether or not mksquashfs provides a way to set the SELinux attributes when the fs is created.
FWIW, I modified mkyaffs2image and make_ext4fs to set SELinux attributes in those filesystems based on an optional file_contexts argument when creating yaffs2 and ext4 images for my Android work, so something similar would likely be needed/desired here.
Well if someone made them open source or available for download...
Squashfs supports xattr since kernel 2.6.39 and mksquashfs since squashfs tools 4.1. In the current mksquashfs version (4.2) on fedora 16, mksquashfs adds extended attributes by default when your create a new image (see mksquashfs --help doc).
I made this change in Rawhide. Stephen do you think this change would break anything in F16? RHEL6? Should I typealias fs_t alias squashfs_t;
What if anything did you have for squashfs in policy prior to this?
Just for info: I noticed when writing my patch that the kernel name for this filesystem is "squashfs" (defined in the file_system_type structure). The current selinux policy uses: genfscon squash / gen_context(system_u:object_r:squash_t,s0) Notice "squash" is used instead of "squashfs". When I first wrote my patch, I tried to replace this genfscon line (and the surrounding definitions of squash_t) with: fs_use_xattr squash gen_context(system_u:object_r:fs_t,s0); And it never worked; I had to replace "squash" with "squashfs". So, maybe, the current selinux rule never worked...
Curious. If so, then I can't see that this would pose any problems; previously squashfs files would have been unlabeled_t and now will be file_t if there are no xattrs or the xattr value if set.
Excellent, a bug makes this update easier. Miroslav can you back port 8f21d75460655bed239a1e0039869f8d54298cfb to F15, F16 and RHEL6.
I just tested your patch from: http://git.fedorahosted.org/git/?p=selinux-policy.git;a=patch;h=8f21d75460655bed239a1e0039869f8d54298cfb Why using fs_use_task instead of fs_use_xattr ? In fact with the fs_use_task, I only get something like unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.cxxx (I did not copied the exact value).
Added to all.
Tested selinux-policy-3.10.0-64.fc16 on Fedora 16 from update-testing. And work as expected. Thanks.
Great. Thanks for your help. Could you update karma? https://admin.fedoraproject.org/updates/FEDORA-2011-16698/selinux-policy-3.10.0-64.fc16?_csrf_token=b5ad893201ac1f5ea9446c3993445f9c37e793eb
Done. Note that the spec file changelog says "Use fs_use_xattr for squashf" It lacks a 's' at the end of squashfS
This message is a reminder that Fedora 16 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 16. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '16'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 16's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 16 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged to click on "Clone This Bug" and open it against that version of Fedora. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping