public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Security issues with local filesystem caching
@ 2006-10-25 10:14 David Howells
  2006-10-25 16:52 ` Nate Diller
                   ` (5 more replies)
  0 siblings, 6 replies; 56+ messages in thread
From: David Howells @ 2006-10-25 10:14 UTC (permalink / raw)
  To: sds, jmorris, chrisw; +Cc: selinux, linux-kernel, dhowells, aviro


Hi,

Some issues have been raised by Christoph Hellwig over how I'm handling
filesystem security in my CacheFiles module, and I'd like advice on how to deal
with them.

CacheFiles stores its cache objects as files and directories in a tree under a
directory nominated by the configuration.  This means the data it is holding
(a) is potentially exposed to userspace, and (b) must be labelled for access
control according to the usual filesystem rules.

Currently, CacheFiles temporarily changes fsuid and fsgid to 0 whilst doing its
own pathwalk through the cache and whilst creating files and directories in the
cache.  This allows it to deal with DAC security directly.  All the directories
it creates are given permissions mask 0700 and all files 0000.

However, Christoph has objected to this practice, and has said that I'm not
allowed to change fsuid and fsgid.  The problem with not doing so is that this
code is running in the context of the process that issued the original open(),
read(), write(), etc, and so any accesses or creations it does would be done
with that process's fsuid and fsgid, which would lead to a cache with bits that
can't be shared between users.

Another thing I'm currently doing is bypassing the usual calls to the LSM
hooks.  This means that I'm not setting and checking security labels and MACs.
The reason for this is again that I'm running in some random process's context
and labelling and MAC'ing will affect the sharability of the cache.  This was
objected to also.

This also bypasses auditing (I think).  I don't want the CacheFiles module's
access to the cache to be logged against whatever process was accessing, say,
an NFS file.  That process didn't ask to access the cache, and the cache is
meant to be transparent.

I can see a few ways to deal with this:

 (1) Do all the cache operations in their own thread (sort of like knfsd).

 (2) Add further security ops for the caching code to call.  These might be of
     use elsewhere in the kernel.  These would set cache-specific security
     labels and check for them.

 (3) Add a flag or something to current to override the normal security on the
     basis that it should be using the cache's security rather than the
     process's security.


Option (1) would lead to serialisation of all cached NFS operations over the
accesses to disk.  Some of these accesses to disk involve sequences of mkdir(),
lookup(), [sg]etxattr() and create() inode op calls - all of which are
synchronous.  On the other hand, option (1) gives the simplest way of
overriding security, and would entail the least work.  It would, though, give
the biggest performance degradation.

Option (2) would require additional security ops, though possibly not many.  It
might be sufficient to just add two: to set and to check the security for a
cache object (be it file or directory).  This option would also preclude use of
the vfs_mkdir() VFS op and suchlike, as they use the wrong sort of security.
Some other way of handling the UNIX file ownership would also have to be sought.

Option (3) would require the current security handling in both the filesystem
(DAC) and security modules (MAC) to check for the overriding context in
current, and to go with that instead.  It might be possible to make such a
thing incorporate fsuid and fsgid.

Thoughts anyone?

David

^ permalink raw reply	[flat|nested] 56+ messages in thread

end of thread, other threads:[~2006-11-15 18:20 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-25 10:14 Security issues with local filesystem caching David Howells
2006-10-25 16:52 ` Nate Diller
2006-10-25 16:48   ` Jeff V. Merkey
2006-10-25 17:21     ` David Howells
2006-10-25 17:42       ` Jeff V. Merkey
2006-10-25 18:15         ` David Howells
2006-10-25 20:21 ` Josef Sipek
2006-10-25 20:28   ` Josef Sipek
2006-10-26  9:56   ` David Howells
2006-10-27 15:54     ` Josef Sipek
2006-10-25 21:12 ` Stephen Smalley
2006-10-26 10:40   ` David Howells
2006-10-26 12:51     ` Stephen Smalley
2006-10-26 16:04       ` David Howells
2006-10-26 16:34         ` Stephen Smalley
2006-10-26 17:09           ` David Howells
2006-10-26 17:45             ` Stephen Smalley
2006-10-26 22:53               ` David Howells
2006-10-27 14:48                 ` Stephen Smalley
2006-10-27 15:42                   ` David Howells
2006-10-27 16:10                     ` Stephen Smalley
2006-10-27 16:25                       ` David Howells
2006-10-27 17:09                         ` Stephen Smalley
2006-10-27 17:34                           ` David Howells
2006-10-27 14:41               ` David Howells
2006-10-25 23:37 ` Alan Cox
2006-10-26  0:32   ` Al Viro
2006-10-26 10:45     ` David Howells
2006-10-26 10:54     ` Alan Cox
2006-10-26  9:14 ` Jan Dittmer
2006-10-26 10:55   ` David Howells
2006-10-26 11:52   ` Alan Cox
2006-10-31 21:26 ` David Howells
2006-11-01 13:28   ` Stephen Smalley
2006-11-01 15:34     ` David Howells
2006-11-01 15:58       ` Karl MacMillan
2006-11-01 17:45         ` Stephen Smalley
2006-11-02 16:29           ` Karl MacMillan
2006-11-02 18:04             ` Stephen Smalley
2006-11-01 17:30       ` Stephen Smalley
2006-11-02 17:16         ` David Howells
2006-11-02 19:49           ` Trond Myklebust
2006-11-02 20:38             ` David Howells
2006-11-02 21:24               ` Trond Myklebust
2006-11-03 10:27                 ` David Howells
2006-11-03 13:41                   ` Trond Myklebust
2006-11-03 15:23                     ` David Howells
2006-11-03 17:30                       ` Trond Myklebust
2006-11-14 19:22                         ` David Howells
2006-11-15 14:05                           ` Trond Myklebust
2006-11-15 15:28                             ` David Howells
2006-11-15 16:41                               ` Trond Myklebust
2006-11-15 18:17                                 ` David Howells
2006-11-03 15:33                     ` David Howells
2006-11-02 20:33           ` Stephen Smalley
2006-11-02 21:05             ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox