All of lore.kernel.org
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 07/10] ovl: add initial revalidate support
Date: Tue, 21 Sep 2010 12:40:56 +1000	[thread overview]
Message-ID: <20100921124056.63408477@notabene> (raw)
In-Reply-To: <E1OwFkH-000742-GV@pomaz-ex.szeredi.hu>

On Thu, 16 Sep 2010 16:47:29 +0200
Miklos Szeredi <miklos@szeredi.hu> wrote:

> On Mon, 06 Sep 2010, NeilBrown wrote:
> > Add dentry_revalidate method and fail validation of either the
> > upper or lower dentry has been renamed or unlinked directly in the
> > otherlying filesystem.
> > This allows such changes to appear promptly in the overlay providing
> > the file isn't currently in use.
> 
> I fixed up some things in the revalidation logic and tested it out.
> There are some unexpected effects, but they boil down to the fact that
> busy directories can't be invalidated.  Mostly it works as expected.
> 
> However, the "rearange directories so that a/b becomes b/a" trick
> still strikes in evil ways.  Consider the following script:
> 
> mkdir /upper/a/b
> cd /mnt/overlay/a
> while true; do
> 	cd b
> 	mv /upper/a/b /upper/b
> 	mv /upper/a /upper/b/a
> 	cd a
> 	mv /upper/b/a /upper/a
> 	mv /upper/b /upper/a/b
> done
> 
> It will create an ever deeper directory tree on the overlay.
> 
> Can this be prevented?  Probably, e.g. lookup should make sure that
> each new directory gets a *unique* set of lower and upper dentries
> (e.g. by creating hash tables indexed by lower and upper dentries).
> 
> Is it worth the trouble?

The only real problem here is that an unprivileged user with direct access
to 'upper' could consume unlimited kernel memory without using a
corresponding mount of storage space (so quotas etc wouldn't stop them).

Maybe the easiest counter-measure to that is to keep track of a 'depth' of
each dentry and disallow lookups that go much beyond PATH_MAX???

Either that or rely in the sysadmin to hide the upper/lower filesystems from
untrusted users.  I particularly see value in sysadmins being able to modify
these filesystem - not so much for 'regular users'.

NeilBrown

> 
> Any other ideas?
> 
> Thanks,
> Miklos
> 
>

  reply	other threads:[~2010-09-21  2:41 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-06  0:50 [PATCH 00/10] Assorted fixes/enhancements for overlayfs NeilBrown
2010-09-06  0:50 ` [PATCH 03/10] ovl: use correct seek function for directories NeilBrown
2010-09-06  0:50 ` [PATCH 01/10] ovl: small optimisation for ovl_lookup NeilBrown
2010-09-06 16:57   ` Miklos Szeredi
2010-09-06  0:50 ` [PATCH 02/10] ovl: minimal remount support NeilBrown
2010-09-06  0:50 ` [PATCH 10/10] ovl: Assorted updates to Documentation/filesystems/overlayfs.txt NeilBrown
2010-09-06  0:50 ` [PATCH 04/10] ovl: initialise is_real before use NeilBrown
2010-09-06  0:50 ` [PATCH 06/10] ovl: rename ovl_fill_cache to ovl_dir_read NeilBrown
2010-09-06  0:50 ` [PATCH 07/10] ovl: add initial revalidate support NeilBrown
2010-09-16 14:47   ` Miklos Szeredi
2010-09-21  2:40     ` Neil Brown [this message]
2010-09-06  0:50 ` [PATCH 09/10] VFS: Remove read-only checks from dentry_permission NeilBrown
2010-09-06 19:10   ` Miklos Szeredi
2010-09-08  7:47     ` Neil Brown
2010-09-08  8:58       ` Miklos Szeredi
2010-09-07 15:58   ` Dave Hansen
2010-09-06  0:50 ` [PATCH 08/10] VFS: tiny optimisation in open_other handling NeilBrown
2010-09-06  0:50 ` [PATCH 05/10] ovl: make sure fsync is never called on the lower filesystem NeilBrown
2010-09-06 17:16   ` Miklos Szeredi
2010-09-06 19:23 ` [PATCH 00/10] Assorted fixes/enhancements for overlayfs Miklos Szeredi

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=20100921124056.63408477@notabene \
    --to=neilb@suse.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.