Skip to content

Permit filesystem local caching and NFS superblock sharing

David Howells lkml selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest17 of 19 patches 36 repliesIn review

17 of 19 patches are in this archive. The cover letter announces 19.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
2/19FS-Cache: Provide a filesystem-specific sync'able page bitfs/afs/dir.c fs/ext2/dir.c fs/ext3/inode.c +8 more+59 -290 replies
3/19FS-Cache: Release page->private after failed readaheadmm/readahead.c+38 -80 replies
4/19FS-Cache: Make kAFS use FS-Cachefs/Kconfig fs/afs/cache.h fs/afs/cell.c +16 more+673 -4260 replies
5/19NFS: Use local cachingfs/Kconfig fs/nfs/Makefile fs/nfs/client.c +14 more+1029 -106 replies
6/19FS-Cache: NFS: Only obtain cache cookies on file open, not on inode readfs/nfs/fscache.h fs/nfs/inode.c include/linux/nfs_fs.h+40 -81 reply
7/19CacheFiles: Add missing copy_page export for ia64arch/ia64/kernel/ia64_ksyms.c+1 -00 replies
8/19CacheFiles: Add a function to write a single page of data to an inodeinclude/linux/fs.h mm/filemap.c+89 -00 replies
9/19CacheFiles: Permit the page lock state to be monitoredinclude/linux/pagemap.h mm/filemap.c+24 -00 replies
10/19CacheFiles: Export things for CacheFilesfs/file_table.c fs/super.c kernel/auditsc.c+5 -00 replies
12/19CacheFiles: Permit a process's create SID to be overriddeninclude/linux/security.h security/dummy.c security/selinux/hooks.c+65 -015 replies
13/19CacheFiles: Add an act-as SID override in task_security_structinclude/linux/security.h security/dummy.c security/selinux/exports.c +4 more+148 -670 replies
14/19CacheFiles: Permit an inode's security ID to be obtainedinclude/linux/security.h security/dummy.c security/selinux/hooks.c+27 -00 replies
15/19CacheFiles: Get the SID under which the CacheFiles module should operateinclude/linux/security.h security/dummy.c security/selinux/hooks.c+34 -00 replies
16/19CacheFiles: Deal with LSM when accessing the cacheDocumentation/filesystems/caching/cachefiles.txt fs/cachefiles/Makefile fs/cachefiles/cf-bind.c +5 more+304 -281 reply
17/19CacheFiles: Use the VFS wrappers for inode opsfs/cachefiles/cf-bind.c fs/cachefiles/cf-interface.c fs/cachefiles/cf-namei.c +2 more+31 -880 replies
18/19CacheFiles: Use VFS lookup servicesfs/cachefiles/cf-namei.c+34 -1900 replies
19/19CacheFiles: Permit daemon to probe inuseness of a cache filefs/cachefiles/cf-daemon.c fs/cachefiles/cf-namei.c fs/cachefiles/internal.h+246 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/19] Permit filesystem local caching and NFS superblock sharing

These patches add local caching for network filesystems such as NFS and AFS.

I've addressed all but one of Christoph's objections. The one objection I haven't yet dealt with is the addition of a new operation for writing a page of the file, but that's controversial, and I'd like feedback on what I've done so far.

The main thing that I've dealt with is the security issue in CacheFiles:

CacheFiles now calls the VFS wrappers for invoking filesystem operations, such as vfs_mkdir(). It does not call any of the inode operations directly anymore.

This means, however, that it has to deal with SELinux, especially when in enforcing mode.

The cachefilesd RPM installs a policy for labelling and accessing the files in the cache, and for providing a security ID for the cachefilesd daemon to run as. It _also_ provides a security ID for the cachefiles module to act as when it is accessing the filesystem on behalf of the process.

The way this is done is that one of the patches:

CacheFiles: Add an act-as SID override in task_security_struct

permits the module to temporarily change the security ID as which a process _acts_. It does _not_ change the process's actual security ID, and so does not interfere with signals, ptraces, /proc/pid/ accesses aimed at that process.

Furthermore, following consultations with Stephen Smalley and others of the SELinux project, it was deemed correct to override fsuid and fsgid of the host process whilst accessing the cache, so these are also modified temporarily by the module during such accesses.

Finally, the file creation SID is also temporarily overridden whilst the module accesses the cache.

All this permits the ownership and accessibility of files in the cache to preclude ordinary access by all processes running on the system, with the exception of cachefilesd. When SELinux is in enforcing mode, the daemon may not read or write the files in the cache according to the policy.

Thanks to Dan Walsh and Karl MacMillan for helping me get the SELinux policy working. There is documentation on this in the patches and in the cachefilesd SRPM/tarball.

Additionally, sysctls are no longer used. Some parameters are modifiable via sysfs. CacheFiles parameters pertaining to the cache are still only modifiable by sending commands to the module over its control interface, though the control interface is now a character device (following GregKH's suggestion).

---
The kernel patches are committed to a GIT tree based on Linus's:

git://git.infradead.org/users/dhowells/fscache-2.6.git

Which can be viewed through:

http://git.infradead.org/?p=users/dhowells/fscache-2.6.git;a=summary

A tarball of patches is available at:

http://people.redhat.com/~dhowells/fscache/patches/nfs+fscache-19.tar.bz2

To use this version of CacheFiles, the cachefilesd-0.8 is also required. It is available as an SRPM:

	http://people.redhat.com/~dhowells/fscache/cachefilesd-0.8-15.fc7.src.rpm

Or as individual bits:

http://people.redhat.com/~dhowells/fscache/cachefilesd-0.8.tar.bz2
http://people.redhat.com/~dhowells/fscache/cachefilesd.fc
http://people.redhat.com/~dhowells/fscache/cachefilesd.if
http://people.redhat.com/~dhowells/fscache/cachefilesd.te
http://people.redhat.com/~dhowells/fscache/cachefilesd.spec

David

--
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.