From: Christian Brauner <brauner@kernel.org>
To: Charles Mirabile <cmirabil@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Lutomirski <luto@kernel.org>, Peter Anvin <hpa@zytor.com>
Subject: Re: [PATCH] vfs: relax linkat() AT_EMPTY_PATH - aka flink() - requirements
Date: Fri, 12 Apr 2024 08:41:09 +0200 [thread overview]
Message-ID: <20240412-gefroren-abzug-49996c3ccc13@brauner> (raw)
In-Reply-To: <CABe3_aGbsPHY9Z5B9WyVWakeWFtief4DpBrDxUiD00qk1irMrg@mail.gmail.com>
On Thu, Apr 11, 2024 at 12:44:46PM -0400, Charles Mirabile wrote:
> On Thu, Apr 11, 2024 at 12:15 PM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > On Thu, 11 Apr 2024 at 02:05, Christian Brauner <brauner@kernel.org> wrote:
> > >
> > > I had a similar discussion a while back someone requested that we relax
> > > permissions so linkat can be used in containers.
> >
> > Hmm.
> >
> > Ok, that's different - it just wants root to be able to do it, but
> > "root" being just in the container itself.
> >
> > I don't think that's all that useful - I think one of the issues with
> > linkat(AT_EMPTY_PATH) is exactly that "it's only useful for root",
> > which means that it's effectively useless. Inside a container or out.
> >
> > Because very few loads run as root-only (and fewer still run with any
> > capability bits that aren't just "root or nothing").
> >
> > Before I did all this, I did a Debian code search for linkat with
> > AT_EMPTY_PATH, and it's almost non-existent. And I think it's exactly
> > because of this "when it's only useful for root, it's hardly useful at
> > all" issue.
> >
> > (Of course, my Debian code search may have been broken).
> >
> > So I suspect your special case is actually largely useless, and what
> > the container user actually wanted was what my patch does, but they
> > didn't think that was possible, so they asked to just extend the
> > "root" notion.
> >
> Yes, that is absolutely the case. When Christian poked holes in my
> initial submission, I started working on a v2 but haven't had a chance
> to send it because I wanted to make sure my arguments etc were
> airtight because I am well aware of just how long and storied the
> history of flink is. In the v2 that I didn't post yet, I extended the
> ability to link *any* file from only true root to also "root" within a
> container following the potentially suspect approach that christian
> suggested (I see where you are coming from with the unobvious approach
I'm sorry, what is suspect about my approach? Your patch in [1] lowered
the capability checks to ns_capable(current_user_ns(), CAP_DAC_READ_SEARCH).
That's very much wrong because it means root in an unprivileged
container could linkat() any file descriptor including any opened by
real root. The permission needs to be tied to the opener of the file.
Otherwise that's guaranteed to break security assumptions. Whereas my
patch avoids that.
[1]: https://lore.kernel.org/all/20231110170615.2168372-2-cmirabil@redhat.com
next prev parent reply other threads:[~2024-04-12 6:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 0:10 Linus Torvalds
2024-04-11 0:20 ` Linus Torvalds
2024-04-11 2:39 ` Linus Torvalds
2024-04-11 9:04 ` Christian Brauner
2024-04-11 12:25 ` Christian Brauner
2024-04-11 16:21 ` Linus Torvalds
2024-04-12 8:56 ` Christian Brauner
2024-04-11 16:15 ` Linus Torvalds
2024-04-11 16:44 ` Charles Mirabile
2024-04-11 17:29 ` Charles Mirabile
2024-04-11 17:35 ` Charles Mirabile
2024-04-11 18:13 ` Linus Torvalds
2024-04-11 19:34 ` Linus Torvalds
2024-04-12 7:45 ` Christian Brauner
2024-04-12 15:36 ` Linus Torvalds
2024-04-11 20:08 ` Charles Mirabile
2024-04-11 20:22 ` Linus Torvalds
2024-04-12 6:44 ` Christian Brauner
2024-04-12 6:41 ` Christian Brauner [this message]
2024-04-12 9:07 ` Christian Brauner
2024-04-12 17:43 ` Linus Torvalds
2024-04-13 9:41 ` Christian Brauner
2024-04-13 15:16 ` Christian Brauner
2024-04-13 17:07 ` Linus Torvalds
2024-04-12 19:22 ` [PATCH] " Charles Mirabile
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=20240412-gefroren-abzug-49996c3ccc13@brauner \
--to=brauner@kernel.org \
--cc=cmirabil@redhat.com \
--cc=hpa@zytor.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®