public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: aviro@redhat.com, linux-kernel@vger.kernel.org,
	selinux@tycho.nsa.gov, chrisw@sous-sol.org, jmorris@namei.org
Subject: Re: Security issues with local filesystem caching
Date: Thu, 26 Oct 2006 11:40:55 +0100	[thread overview]
Message-ID: <8567.1161859255@redhat.com> (raw)
In-Reply-To: <1161810725.16681.45.camel@moss-spartans.epoch.ncsc.mil>

Stephen Smalley <sds@tycho.nsa.gov> wrote:

> So you have two problems:
> 1) You want the cachefiles kernel module to be able to internally access
> the cache files without regard to the permissions of the current
> process.
> 2) You want to control how userspace may access the cache files in a way
> that allows the cache daemon to do its job without exposing the cache to
> corruption or leakage by other processes.

That's about it, yes.

I wanted the management daemon to live in userspace because it has to create a
couple of big tables of cullable objects and then keep them around for when
culling becomes a necessity.  Filling the tables takes a long time, and it
gets longer the more object you have in the cache.

> With regard to (1), bypassing security checks for internal access is
> already done in certain cases (e.g. fs-private inodes, kernel-internal
> sockets).  That can be done just by a flag on the task as in option (3);
> it is separate from the issue of how to label the new file.

Yeah...

> Your solutions for (2) seem to treat the entire cache as having the same
> security properties regardless of the files that are being cached - a
> single ownership and security context for all cache files.

Yes.  NFS handles the security for the user, so for files in the cache that
are acting as data storage objects, I can just have as restrictive a security
as I can manage.

> This requires a fully trusted cache daemon that can arbitrarily tamper with
> any content cached in this manner.

Well, we could say that the cache daemon isn't actually allowed to read or
write any of these files; all it need to do is read their cache xattrs, names
and atimes, and rename and delete them.  It also needs to be able to do
readdir and lookup on the directories contained therein.

> I think you need to support at least per-cache security attributes, and
> allow people to run separate instances of the cache daemon for caches with
> different security attributes (if not already possible), so that no single
> cache daemon process needs to be all powerful.

My plan is to have a separate cache daemon for each cache.  That way the cull
table filling isn't serialised over all caches.

> If I understand correctly, you don't want to just propagate the security
> attributes of the original file being cached to the cache file,

That is correct.

> because that would expose the cache to corruption by processes that can
> access the original file

Yes.

> and because you would then have to deal with updating those attributes upon
> changes to the original's attributes.

Yes.

But also because the netfs may impose stricter access controls than can be
represented in filesystem underlying the cache.

But mainly because the cache management daemon has to be able to operate on
the cache.

> But per-cache security attributes would be a reasonable approach to enabling
> finer-grained protection.

I'm not sure what you mean by this exactly.  I'd be happy to set the same
security attributes on the files and directories in the cache that impose
draconian restrictions, but whatever I do has to be representable in the
backing filesystem across reboots.

> Then the question is just how the cachefile module sets the security
> attributes (including uid/gid and security context) to the appropriate
> per-cache value when creating the cache files.

Yes.

> That could just be a matter of setting the fsuid/fsgid and fscreate
> attributes (the latter requiring a hook call) prior to creation, if that
> approach is palatable.

It is to me.

> It would help to understand the objection to setting fsuid/fsgid more
> clearly - it may have had more to do with always setting them to 0 for all
> cache files, or with using that as a way to work around the lack of an
> explicit mechanism for bypassing security checks for internal accesses than
> with the setting of the fsuid/fsgid itself.

Christoph did enscribe thus:

| - in cachefiles_walk_to_object reseting the fsuid/fsgid is not allowed

Which I take to mean that I'm not allowed to change fsuid and fsgid.  Why not,
I'm not entirely certain.  I wouldn't have thought it would matter as long as
I put them back again before returning.

David

  reply	other threads:[~2006-10-26 10:41 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8567.1161859255@redhat.com \
    --to=dhowells@redhat.com \
    --cc=aviro@redhat.com \
    --cc=chrisw@sous-sol.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sds@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox