linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Viro <viro@math.psu.edu>
To: Chris Wedgwood <cw@f00f.org>
Cc: Hans Reiser <reiser@namesys.com>,
	Linus Torvalds <torvalds@transmeta.com>,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Chris Mason <mason@suse.com>
Subject: Re: [PATCH] 2.4.8-pre3 fsync entire path (+reiserfs fsync semanticchange patch)
Date: Sat, 4 Aug 2001 21:47:21 -0400 (EDT)	[thread overview]
Message-ID: <Pine.GSO.4.21.0108042114190.10111-100000@weyl.math.psu.edu> (raw)
In-Reply-To: <20010805063123.A20164@weta.f00f.org>



On Sun, 5 Aug 2001, Chris Wedgwood wrote:

> On Sat, Aug 04, 2001 at 11:45:47AM +0400, Hans Reiser wrote:
> 
>     Can you define f_cred for us?
> 
> Surely is becomes a fs-specific opaque type, void* or whatever?  For
> many filesystems it somply won't be relevant, and for some filesystems
> such as NFS and Coda, presumably it will need deep fs-specific
> details?

Not really. It _is_ relevant for, say it, ext2. Why? Because we need that
to handle, e.g. 5% reserve. Look:

	Disk is almost full. We have only 3% of blocks free and in that
situation only root should be able to allocate more.
	User foo creates an empty file. No blocks allocated, so we are OK.
He does truncate() to, say it, 10Mb. Still no block allocations.
	He mmaps that file. And does memset() on mmaped area. Now we have
a bunch of dirty pages. Well, eventually kswapd will write them out, right?
	What UID does kswapd run under? Exactly. Welcome to the fun - we've
managed to trick the system into allocating 10Mb of disk space for us, since
in the allocation time UID and GID were 0.
	Now that we have these blocks allocated, usual write() will succeeed
just fine - no block allocation, no checks.

See what I mean? Blind use of current->fsuid et.al. in filesystem code is a
Bad Thing(tm). We really want to know who is responsible for the operation
and "current task" is not always the right answer.

What we need is a cache of objects that would contain (at least) UID,
GID and auxillary groups. That, and ability to add extra authentication
tokens. Process should have a pointer to its current credentials (quite
possibly shared by many processes). Ditto for an opened file. When we
open a file we should simply inherit credentials of opening process.
When we do seteuid(2), etc., we should create a separate copy of current
credentials, modify that copy, drop the reference to old creds and set
the pointer to credentials to the modified copy. Fs operations should
(eventually) be changed to get credentials explicitly - as an argument.
That, BTW, would allow knfsd to avoid the silly games with setting
->fsuid for the duration of fs operation - we could simply pass the
credentials of the party responsible for NFS request to filesystem
methods.

It's nothing new - both the problem and solution are well-known since
at least early 90s. All this stuff is pretty straightforward, but it
can't be done in 2.4 - it involves changing the prototypes of fs
methods. Changes to the bodies of methods (i.e. to fs code) are
minimal - basically, it's a search-and-replace job that can be done
at once on the whole tree. However, such things do not belong to
-STABLE.

PS: probably "identity" would be a better term than "credentials". It's
a "look, I'm acting on behalf of Joe R. User and I carry a bunch of IDs to
prove that" thing.


  reply	other threads:[~2001-08-05  1:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0108030507330F.00440@starship>
     [not found] ` <Pine.GSO.4.21.0108022312211.1494-100000@weyl.math.psu.edu>
2001-08-03 13:09   ` intermediate summary of ext3-2.4-0.9.4 thread Daniel Phillips
2001-08-03 14:43     ` Horst von Brand
2001-08-03 17:49     ` Mike Castle
2001-08-04  3:23       ` Daniel Phillips
2001-08-03 18:08     ` Alexander Viro
2001-08-03 18:26       ` Daniel Phillips
2001-08-03 18:53         ` Alexander Viro
2001-08-03 20:50           ` Daniel Phillips
2001-08-04  3:43           ` Matthias Andree
2001-08-03 18:34       ` Linus Torvalds
2001-08-03 22:01         ` [PATCH] 2.4.8-pre3 fsync entire path (+reiserfs fsync semantic change patch) Chris Wedgwood
2001-08-03 22:33           ` Alexander Viro
2001-08-03 23:16             ` Chris Wedgwood
2001-08-03 23:23               ` Alexander Viro
2001-08-04  3:53                 ` Matthias Andree
2001-08-04  5:48                   ` Alexander Viro
2001-08-03 22:45           ` Alexander Viro
2001-08-03 23:09             ` Chris Wedgwood
2001-08-03 23:15               ` Alexander Viro
2001-08-03 23:20                 ` Chris Wedgwood
2001-08-03 23:25                   ` Alexander Viro
2001-08-03 23:35                     ` Chris Wedgwood
2001-08-03 23:41                       ` Alexander Viro
2001-08-03 23:46                         ` Chris Wedgwood
2001-08-03 23:53                           ` Alexander Viro
2001-08-04  7:45                             ` [PATCH] 2.4.8-pre3 fsync entire path (+reiserfs fsync semanticchange patch) Hans Reiser
2001-08-04 18:31                               ` Chris Wedgwood
2001-08-05  1:47                                 ` Alexander Viro [this message]
2001-08-08 17:22                                   ` [PATCH] 2.4.8-pre3 fsync entire path (+reiserfs fsync semanticchangepatch) Hans Reiser
2001-08-03 23:42                       ` [PATCH] 2.4.8-pre3 fsync entire path (+reiserfs fsync semantic change patch) Alan Cox
2001-08-03 23:44                         ` Chris Wedgwood
2001-08-04  1:08           ` Andrew Morton
2001-08-04  1:19             ` Chris Wedgwood
2001-08-04  1:45               ` Andrew Morton
2001-08-04  4:04                 ` Matthias Andree
2001-08-04 18:30                   ` Chris Wedgwood
2001-08-05 12:15                     ` Matthias Andree
2001-08-05 12:32                       ` Chris Wedgwood
2001-08-05 13:02                         ` Matti Aarnio
2001-08-04 21:07                   ` Andrew Morton
2001-08-04 21:07               ` Andrew Morton
2001-08-05  7:25                 ` Chris Wedgwood
2001-08-09 13:25                 ` Matthias Andree
2001-08-04 17:35           ` Jan Harkes
2001-08-04 18:18             ` Chris Wedgwood
2001-08-06 15:02           ` Chris Mason
2001-08-06 20:48             ` Chris Wedgwood
2001-08-03 22:29       ` Anton Altaparmakov
2001-08-03 23:06         ` Chris Wedgwood
2001-08-06 15:23         ` looking for resources for designing loopback filesystem dave-mlist
2001-08-06 16:11           ` Ville Herva
2001-08-03 18:36   ` intermediate summary of ext3-2.4-0.9.4 thread Matthias Andree
2001-08-03 19:16     ` Alexander Viro
2001-08-04  3:40       ` fdatasync(2) is also there (was: intermediate summary of ext3-2.4-0.9.4 thread) Matthias Andree
2001-08-05  0:28         ` Mike Castle

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=Pine.GSO.4.21.0108042114190.10111-100000@weyl.math.psu.edu \
    --to=viro@math.psu.edu \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cw@f00f.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@suse.com \
    --cc=reiser@namesys.com \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).