From: ebiederm@xmission.com (Eric W. Biederman)
To: Andy Lutomirski <luto@amacapital.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linux API <linux-api@vger.kernel.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
John Stultz <john.stultz@linaro.org>,
Arnd Bergmann <arnd@arndb.de>, Tejun Heo <tj@kernel.org>,
Marcel Holtmann <marcel@holtmann.org>,
Ryan Lortie <desrt@desrt.ca>, Bastien Nocera <hadess@hadess.net>,
David Herrmann <dh.herrmann@gmail.com>,
Djalal Harouni <tixxdz@opendz.org>,
simon.mcvittie@collabora.co.uk, daniel@zonque.org,
alban.crequy@collabora.co.uk, javier.martinez@collabora.co.uk,
Tom Gundersen <teg@jklm.no>,
Linus Torvalds <torvalds@linux-foundation.org>,
Linux Containers <containers@lists.linux-foundation.org>
Subject: Re: [PATCH 00/12] Add kdbus implementation
Date: Wed, 29 Oct 2014 21:20:23 -0700 [thread overview]
Message-ID: <87bnourxx4.fsf@x220.int.ebiederm.org> (raw)
In-Reply-To: <CALCETrVxvF2ie=vVgpjeqikn+nci_9jyKfU4s3t=4cjyNZNaNQ@mail.gmail.com> (Andy Lutomirski's message of "Wed, 29 Oct 2014 19:27:54 -0700")
The userspace API breaks userspace in an unfixable way.
Nacked-by: "Eric W. Biederman" <ebiederm@xmission.com>
Problem the first.
- Using global names for containers makes it impossible to create
unprivileged containers.
This is a back to the drawing board problem, and makes device
nodes fundamentally unsuited to what you are doing.
There is no way that I can see to make it safe for an unprivileged
user to create arbitrary named busses. Especially in the presence
of allowing unprivileged checkpoint/restart.
This is particularly bad as kdbus explicitly allows unprivielged
creation of new kdbus instances.
This problem is a userspace regression.
Problem the second.
- The security checks in the code are not based on who opens the
file descriptors but instead based on who is used the file
descriptors at any give moment.
That pattern has been shown to be exploitable.
I expect the policy database makes this poor choice of permission
checks even worse. Pass a more privileged user a kdbus file
descriptor and all of sudden things that were not possible on
that file descriptor become possible.
Problem the third.
- You are using device numbers for things created by unprivileged
users. That breaks checkpoint/restart. Aka CRIU.
We can not migrate a container to a new machine and preserve the
device numbers.
We can not migrate a container to a new machine and have any hope
of preserving the container patsh under /dev/kdbus/...
Both of which look like fundamental show stoppers for
checkpoint/restart.
Andy Lutomirski <luto@amacapital.net> writes:
> On Wed, Oct 29, 2014 at 3:27 PM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
>> On Wed, Oct 29, 2014 at 03:15:51PM -0700, Andy Lutomirski wrote:
>>> (reply 1/2 -- I'm replying twice to keep the threading sane)
>>>
>>> On Wed, Oct 29, 2014 at 3:00 PM, Greg Kroah-Hartman
>>> <gregkh@linuxfoundation.org> wrote:
>>> > kdbus is a kernel-level IPC implementation that aims for resemblance to
>>> > the the protocol layer with the existing userspace D-Bus daemon while
>>> > enabling some features that couldn't be implemented before in userspace.
>>> >
>>>
>>> > * Support for multiple domains, completely separated from each other,
>>> > allowing multiple virtualized instances to be used at the same time.
>>>
>>> Given that there is no such thing as a device namespace, how does this work?
>>
>> See the document for the details.
>
> They seem insufficient to me, so I tried to dig in to the code. My
> understanding is:
>
> The parent container has /dev mounted. It sends an IOCTL (which
> requires global capabilities). In response, kdbus creates a whole
> bunch of devices that get put (by udev or devtmpfs, I presume) in a
> subdirectory. Then the parent container mounts that subdirectory in
> the new container.
>
> This is IMO rather problematic.
>
> First, it enforces the existence of a kdbus domain hierarchy where
> none should be needed.
>
> Second, it's incompatible with nested user namespaces. The middle
> namespace can't issue the ioctl.
>
> Third, it requires a devtmpfs submount in the child container. This
> scares me, especially since there are no device namespaces. Also, the
> child container appears to be dependent on the host udev to arbitrate
> everything, which seems totally wrong to me. (Also, now we're exposed
> to attacks where the child container creates busses or endpoints or
> whatever with malicious names to try to trick the host into screwing
> up.)
>
> ISTM this should be solved either with device namespaces (which is
> well known to be a giant can of worms) or by abandoning the concept of
> kdbus using device nodes entirely.
>
> What if kdbus were kdbusfs? If you want to use it in a container, you
> mount a brand-new kdbusfs there. No weird domain hierarchy, no global
> privilege, no need to name containers, obvious migration semantics, no
> dependence on udev/devtmpfs at all, etc.
>
> Eric, any thoughts here?
I think a kdbusfs modeled on devpts with newinstance at
mount time would solve the naming problems.
That would break one of the current kdbus use cases that allows an
unprivileged user to create a bus.
Eric
p.s. Please excuse my brevity I have am in the middle of packing up my
possessions (including my main machine), as I move this week.
next prev parent reply other threads:[~2014-10-30 4:22 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 22:00 Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add documentation Greg Kroah-Hartman
2014-10-30 12:20 ` Peter Meerwald
2014-11-02 1:29 ` Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add header file Greg Kroah-Hartman
2014-10-30 8:20 ` Arnd Bergmann
2014-10-30 11:02 ` Tom Gundersen
2014-10-30 11:26 ` Arnd Bergmann
2014-10-30 11:52 ` Daniel Mack
2014-10-30 12:03 ` Arnd Bergmann
2014-10-31 10:03 ` Daniel Mack
2014-10-29 22:00 ` kdbus: add driver skeleton, ioctl entry points and utility functions Greg Kroah-Hartman
2014-10-30 3:50 ` Eric W. Biederman
2014-10-30 23:45 ` Thomas Gleixner
2014-10-31 0:23 ` Jiri Kosina
2014-10-31 0:42 ` Thomas Gleixner
2014-10-29 22:00 ` kdbus: add connection pool implementation Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add connection, queue handling and message validation code Greg Kroah-Hartman
[not found] ` <87k33iw759.fsf@x220.int.ebiederm.org>
2014-10-30 3:55 ` Andy Lutomirski
2014-10-30 9:06 ` Djalal Harouni
2014-10-29 22:00 ` kdbus: add code to gather metadata Greg Kroah-Hartman
2014-10-29 22:33 ` Andy Lutomirski
2014-10-30 0:13 ` Andy Lutomirski
2014-10-30 8:45 ` Daniel Mack
2014-10-30 14:07 ` Andy Lutomirski
2014-10-30 15:54 ` Daniel Mack
2014-10-30 21:01 ` Andy Lutomirski
2014-11-01 11:05 ` Daniel Mack
2014-11-01 16:19 ` Andy Lutomirski
2014-11-03 12:00 ` Simon McVittie
2014-11-03 17:05 ` Andy Lutomirski
2014-10-30 8:09 ` Daniel Mack
2014-10-29 22:00 ` kdbus: add code for notifications and matches Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add code for buses, domains and endpoints Greg Kroah-Hartman
2014-10-30 3:59 ` Eric W. Biederman
2014-10-30 9:58 ` Djalal Harouni
2014-10-30 12:15 ` Eric W. Biederman
2014-10-30 14:48 ` Djalal Harouni
2014-10-30 14:58 ` Andy Lutomirski
2014-10-30 18:08 ` Djalal Harouni
2014-10-30 18:46 ` Simon McVittie
2014-11-05 19:59 ` Djalal Harouni
2014-10-30 20:37 ` Andy Lutomirski
[not found] ` <m2ublh$5h7$2@ger.gmane.org>
2014-10-30 22:00 ` Andy Lutomirski
2014-10-30 23:38 ` How Not To Use kref (was Re: kdbus: add code for buses, domains and endpoints) Al Viro
2014-10-31 18:00 ` Linus Torvalds
2014-10-31 19:56 ` Al Viro
2014-11-04 9:11 ` David Herrmann
2014-10-31 1:39 ` kdbus: add code for buses, domains and endpoints Al Viro
2014-10-31 9:55 ` Daniel Mack
2014-10-29 22:00 ` kdbus: add name registry implementation Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add policy database implementation Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add Makefile, Kconfig and MAINTAINERS entry Greg Kroah-Hartman
2014-10-29 22:00 ` kdbus: add selftests Greg Kroah-Hartman
2014-10-30 8:31 ` Arnd Bergmann
2014-11-14 3:42 ` Michael Ellerman
2014-11-14 8:56 ` Daniel Mack
2014-10-29 22:15 ` [PATCH 00/12] Add kdbus implementation Greg KH
2014-10-30 4:04 ` Eric W. Biederman
2014-10-30 7:12 ` Daniel Mack
2014-10-29 22:15 ` Andy Lutomirski
2014-10-29 22:27 ` Greg Kroah-Hartman
2014-10-29 22:34 ` Andy Lutomirski
2014-10-30 2:27 ` Andy Lutomirski
2014-10-30 4:20 ` Eric W. Biederman [this message]
2014-10-30 10:15 ` Tom Gundersen
2014-10-30 12:02 ` Eric W. Biederman
2014-10-30 13:48 ` Andy Lutomirski
2014-10-29 22:19 ` Andy Lutomirski
2014-10-29 22:25 ` Greg Kroah-Hartman
2014-10-29 22:28 ` Andy Lutomirski
2014-10-29 22:36 ` Andy Lutomirski
2014-10-30 7:44 ` Daniel Mack
2014-11-05 14:34 ` Daniel Mack
2014-10-29 23:00 ` Jiri Kosina
2014-10-29 23:11 ` Greg Kroah-Hartman
2014-10-29 23:12 ` Greg Kroah-Hartman
2014-10-29 23:24 ` Jiri Kosina
2014-10-29 23:26 ` Jiri Kosina
2014-10-29 23:34 ` Greg Kroah-Hartman
2014-10-29 23:40 ` Greg Kroah-Hartman
2014-10-29 23:55 ` Andy Lutomirski
2014-10-30 11:52 ` Tom Gundersen
2014-10-30 12:28 ` Simon McVittie
2014-10-30 13:59 ` Andy Lutomirski
2014-10-30 20:28 ` Alex Elsayed
2014-10-30 9:51 ` Karol Lewandowski
2014-10-30 10:44 ` Karol Lewandowski
2014-10-30 14:47 ` Greg Kroah-Hartman
2014-10-30 19:55 ` Karol Lewandowski
2014-10-30 20:24 ` Greg Kroah-Hartman
2014-10-31 11:15 ` Karol Lewandowski
2014-10-30 23:13 ` One Thousand Gnomes
2014-10-31 10:58 ` Karol Lewandowski
2014-10-30 23:39 ` Paul Moore
2014-10-31 14:21 ` Karol Lewandowski
[not found] ` <1414773397-26490-1-git-send-email-k.lewandowsk@samsung.com>
[not found] ` <20141107180120.GA15387@kroah.com>
2014-11-09 0:07 ` [RFC PATCH 0/5] kdbus: add support for lsm Karol Lewandowski
[not found] ` <1414773397-26490-2-git-send-email-k.lewandowsk@samsung.com>
2014-11-17 1:47 ` [PATCH 1/5] kdbus: extend structures with security pointer " Karol Lewandowski
2014-11-17 18:37 ` Greg KH
2014-11-02 1:21 ` [PATCH 00/12] Add kdbus implementation Greg Kroah-Hartman
2014-11-03 14:38 ` One Thousand Gnomes
2014-10-30 8:33 ` Arnd Bergmann
2014-10-30 16:17 ` Greg Kroah-Hartman
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=87bnourxx4.fsf@x220.int.ebiederm.org \
--to=ebiederm@xmission.com \
--cc=alban.crequy@collabora.co.uk \
--cc=arnd@arndb.de \
--cc=containers@lists.linux-foundation.org \
--cc=daniel@zonque.org \
--cc=desrt@desrt.ca \
--cc=dh.herrmann@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hadess@hadess.net \
--cc=javier.martinez@collabora.co.uk \
--cc=john.stultz@linaro.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=marcel@holtmann.org \
--cc=simon.mcvittie@collabora.co.uk \
--cc=teg@jklm.no \
--cc=tixxdz@opendz.org \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.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
Powered by JetHome