From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: btrfs and containers
Date: Fri, 11 Mar 2016 02:50:53 +0000 (UTC) [thread overview]
Message-ID: <pan$5ccec$498efbab$a72ad404$705bc0c4@cox.net> (raw)
In-Reply-To: CAJCQCtQVUiVhjop5oE9G_XzReXw=GFtQDgHtjn2=X_qwwsPt8A@mail.gmail.com
Chris Murphy posted on Thu, 10 Mar 2016 12:35:31 -0700 as excerpted:
> It's a tricky problem. If you're the owner of a filesystem tree, but
> something definitely not owned at all by you is buried in that tree
> somewhere, to do a subvolume delete don't you have to now traverse the
> entire thing to find out? Or does the owning user have sufficient
> implied permission by owning the subvolume, that no matter what's in it,
> is simply gone unless it's another subvolume?
Well, to the extent that subvolumes aren't special, they're supposed to
behave like subdirs. So it seems simple enough to me, just use subdir
permissions semantics and don't worry about it.
Which means you can delete files you don't own located directly in a
directory (so subvol) you have write permissions to, even if you couldn't
write to the files themselves, but if those files are in turn nested in a
subdir you can't write to, then you can't delete the files (even if you
actually own the files and can write to them, meaning you could change
them, but not delete them), and thus can't delete the dir, which means
you can't delete its parent dir... or subvol.
At least, that's the way it /should/ work.
Unless of course subvolumes are documented to be special in that regard,
since subvolumes are allowed to differ in behavior from subdirs if that's
a specific feature of being a subvolume, in which case the documentation
can simply document the way it works, which can be arbitrarily defined as
convenient for the implementation if desired, and be done with it.
Of course, if subvolumes were /not/ declared to be special in that
regard, and thus were supposed to fit the subdir model, actually
implementing that would involve crawling the subdir tree checking the
ownership and permissions of all nested subdirs and subvols, as many
layers deep as it goes, and that would need done in the foreground,
before the deletion could return, which would tend to slow down the
subvolume delete implementation toward that of subdir delete. So of
speedy subvolume delete is to be retained, then it seems subvols need to
be defined to have special subvol behavior in this regard, that does NOT
follow subdir behavior, with that special behavior being defined as, if
you own the subvolume, you can delete it (and its children), regardless
of whether you'd have permissions to delete files in the subdirs beneath
it and thus couldn't delete it were it a regular subdir.
But that brings up the opposite question, or otherwise put, the same
question in the other direction, as well. Currently, users can create
subvols but not (ordinarily) delete them. Can they create those subvols
in directories they don't have write permissions in, and thus couldn't
create subdirs or files in? If so, that seems to be another security
issue waiting to be exploited. If not, then even if they have ownership
of the subvol itself, they shouldn't be able to delete it, if it's in a
subdir they don't have write permissions in and thus couldn't create it
in.
Every time this sort of subvolumes permissions issue comes up, I get a
(metaphorical) headache trying to sort out the permissions and thus
security implications, and end up glad I'm simply not dealing with them
here. Tho I can't do anything about the security implications if normal
users can create them, even if my policy is not to do so. Which does
have me somewhat worried, because that sort of problem is notorious for
its unforeseen security implications, and right now, because any user
(presumably with write permissions on any subdir on a btrfs) can create
subvolumes, that means anyone running btrfs is exposed to those
convoluted and likely unforeseen security issues.
Which is definitely another reason not to consider btrfs fully
stabilized, until that sort of thing gets sorted. Personally, I'd say
just require superuser privs (and/or appropriate filecaps and/or SEL
security labels) to create them as well, and avoid the whole problem.
Yes, it'll be limiting, but it's a limit that will avoid the entire
Pandora's box of permissions and security implications.
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
next prev parent reply other threads:[~2016-03-11 2:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 22:55 btrfs and containers Tobias Hunger
2016-03-07 23:45 ` Chris Murphy
2016-03-08 19:58 ` Liu Bo
2016-03-08 21:28 ` Chris Murphy
2016-03-09 12:15 ` Austin S. Hemmelgarn
2016-03-10 2:55 ` Duncan
2016-03-10 17:04 ` Austin S. Hemmelgarn
2016-03-10 19:35 ` Chris Murphy
2016-03-10 22:34 ` Liu Bo
2016-03-11 2:50 ` Duncan [this message]
2016-03-08 12:12 ` Austin S. Hemmelgarn
2016-03-09 21:10 ` Marc MERLIN
2016-03-09 21:21 ` Chris Murphy
2016-03-09 21:45 ` Marc MERLIN
2016-03-09 23:28 ` Rich Freeman
-- strict thread matches above, loose matches on Subject: below --
2016-03-11 3:55 Tomasz Chmielewski
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='pan$5ccec$498efbab$a72ad404$705bc0c4@cox.net' \
--to=1i5t5.duncan@cox.net \
--cc=linux-btrfs@vger.kernel.org \
/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).