mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Cedric Le Goater <clg@fr.ibm.com>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	Kirill Korotaev <dev@openvz.org>, Andrey Savochkin <saw@sw.ru>,
	Herbert Poetzl <herbert@13thfloor.at>,
	Sam Vilain <sam.vilain@catalyst.net.nz>,
	"Serge E. Hallyn" <serue@us.ibm.com>,
	Dave Hansen <haveblue@us.ibm.com>
Subject: Re: [PATCH -mm 0/7] execns syscall and user namespace
Date: Wed, 12 Jul 2006 10:56:06 -0600	[thread overview]
Message-ID: <m11wsqbw49.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <44B4F3AE.60607@fr.ibm.com> (Cedric Le Goater's message of "Wed, 12 Jul 2006 15:05:50 +0200")

Cedric Le Goater <clg@fr.ibm.com> writes:

> Hello !
>
> Hopefully, we will soon see each other at OLS. We need some synchronous
> interaction !
>
> Eric W. Biederman wrote:
>
>>>> Is it not possible to ensure what you are trying to ensure with
>>>> a good user space executable?
>>> unshare() is unsafe for some namespaces because namespaces can reference
>>> each other. For the ipc namespace, example are shm ids vs. vma, sem ids vs.
>>> semundos, msq vs. netlink sockets. for the user namespace, open files. So
>>> it seems reasonable to provide a way to unshare namespaces from a clean
>>> process context.
>> 
>> It is perfectly legitimate to have a shared memory region memory mapped
>> from another namespace. 
>
> then after unshare, a process can be in ipc namespace B with a shared
> memory segment from ipc namespace A without any id for this segment. this
> is not very consistent. the same process will also be able to modify the
> ipc namespace B without being in this namespace. ugly. It looks like an
> issue that should be solved.
>
> I think namespace should enforce strict isolation. nop ?
>
>> Yes sem ids versus semunds is an issue but it just requires you to unshare
>> one at the same time you unshare the other, or to simply clone a new
>> namespace.
>
> hmm, semids the from ipc namespace are stored in task->sysv_sem. i would
> forbid the unshare/clone in that case or flush the semundos like in
> exit_sem(). but it's easier not to have any, like in a clean process image.
>
>> I'm not familiar with the msq vs netlink socket issue.  
>
> mq_notify can use a netlink socket to send an event back user space.

Ok.  That one is a mess, and I almost recall seeing that.  A big
chunk of that is a general netlink socket problem.  Getting enough
context in a netlink socket is a challenge because you can't use current.
I do think solving that is achievable though.  Just very peculiar.

>> As for the user namespace vs open files.  If we have any issues with open
>> files in any namespace that sounds like an implementation bug to me.
>
> user_struct does accounting on process, open files, locked memory, signals,
> etc. if you unshare such an object, you will need to unshare all others
> namespaces to be consistent. again having a clean process image is easier ...

I just don't see it.    The accounting is about objects and the namespaces
are about names of those objects.

>> I'm not convinced the problems you are seeing are not implementation bugs.
>> For some things clone is still more general then unshare, and clone should
>> be considered the primary user interface, not unshare.
>
> agree on that, i might be focusing a bit too much on the unshare syscall.
> we should work on clone to make sure it has the required restrictions. The
> system is really interlinked and not all namespaces can be unshared standalone.

I completely agree that there are pieces that interlink.

>>> Now, if you try to do that from user space, you will call unshare() then
>>> execve(), which leaves plenty of room and time for nasty things to happen
>>> in between the 2 calls.
>> 
>> I will look more closely but I think there is an important point being missed
>> somewhere.  Pieces of the kernel interact in all sorts of weird and unexpected
>> ways.  If we rely on ourselves always being in the right magic namespace for
>> things to work correctly we are setting ourselves up for trouble.  If we know
>> a namespace implementation will work even when a process has access to
> entities
>> in multiple instances of that namespace we are in much better shape.
>
> having a clean process image is IMHO required for some namespaces :
>
> http://marc.theaimsgroup.com/?l=linux-kernel&m=113881171017330&w=2

That message is a terrible example.  Unless you are thinking of something
farther down that thread.  User space getting confused when it creates
a container is just an implementation of the container creation code.

Now I'm not certain what you mean by a clean process image, as there are always
left over pieces from the parent.  Clone creates a new task_struct.  exec replaces
the executable.  They both keep files open.


Eric


  reply	other threads:[~2006-07-12 16:57 UTC|newest]

Thread overview: 104+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-11  7:50 Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 1/7] add execns syscall core routine Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 2/7] add execns syscall to s390 Cedric Le Goater
2006-07-11 13:44   ` Martin Schwidefsky
2006-07-11 13:44   ` Martin Schwidefsky
2006-07-11 14:44     ` Cedric Le Goater
2006-07-11 14:54       ` Martin Schwidefsky
2006-07-11 15:43         ` Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 3/7] add execns syscall to x86_64 Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 4/7] add execns syscall to i386 Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 5/7] add user namespace Cedric Le Goater
2006-07-11 16:39   ` Kirill Korotaev
2006-07-11 17:38     ` Cedric Le Goater
2006-07-12 11:21       ` Kirill Korotaev
2006-07-13 16:01         ` Cedric Le Goater
2006-07-12  3:33     ` Eric W. Biederman
2006-07-12 11:13       ` Kirill Korotaev
2006-07-12 18:10         ` Eric W. Biederman
2006-07-13 17:00           ` Cedric Le Goater
2006-07-13 18:07             ` Eric W. Biederman
2006-07-13 18:21             ` Eric W. Biederman
2006-07-13 18:31               ` Dave Hansen
2006-07-13 18:54                 ` Eric W. Biederman
2006-07-12  3:46   ` Eric W. Biederman
2006-07-12 12:05     ` Herbert Poetzl
2006-07-12 17:09       ` Eric W. Biederman
2006-07-12 14:00     ` Cedric Le Goater
2006-07-12 17:24       ` Eric W. Biederman
2006-07-13 17:36         ` Cedric Le Goater
2006-07-13 17:47           ` Serge E. Hallyn
2006-07-13 18:14             ` Eric W. Biederman
2006-07-13 18:29               ` Dave Hansen
2006-07-13 19:02                 ` Eric W. Biederman
2006-07-13 20:03                   ` Dave Hansen
2006-07-14  3:45                     ` Eric W. Biederman
2006-07-14 14:28                       ` Dave Hansen
2006-07-14 15:13                         ` Eric W. Biederman
2006-07-14 16:29                           ` Serge E. Hallyn
2006-07-14 16:49                             ` Eric W. Biederman
2006-07-14 16:55                               ` Dave Hansen
2006-07-14 17:08                                 ` Serge E. Hallyn
2006-07-14 17:19                                   ` Dave Hansen
2006-07-14 17:36                                     ` Eric W. Biederman
2006-07-14 18:15                                       ` Trond Myklebust
2006-07-14 18:40                                         ` Eric W. Biederman
2006-07-14 21:04                                           ` Trond Myklebust
2006-07-15  4:09                                             ` Eric W. Biederman
2006-07-15  4:35                                               ` Kyle Moffett
2006-07-15 12:35                                                 ` Eric W. Biederman
2006-07-15 13:25                                                   ` Kyle Moffett
2006-07-15 15:54                                                   ` Dave Hansen
2006-07-15 17:01                                                   ` Trond Myklebust
2006-07-15 23:29                                                     ` Eric W. Biederman
2006-07-16 16:18                                                       ` Dave Hansen
2006-07-14 17:14                                 ` Eric W. Biederman
2006-07-16  8:36                                 ` Kirill Korotaev
2006-07-16 10:08                                   ` Eric W. Biederman
2006-07-14 17:05                               ` Serge E. Hallyn
2006-07-14 17:50                                 ` Kyle Moffett
2006-07-15 11:33                                   ` Serge E. Hallyn
2006-07-14 17:56                                 ` Eric W. Biederman
2006-07-14 16:35                           ` Dave Hansen
2006-07-13 21:41                   ` Serge E. Hallyn
2006-07-14  3:52                     ` Eric W. Biederman
2006-07-14 14:02                       ` Serge E. Hallyn
2006-07-14 14:50                         ` Eric W. Biederman
2006-07-14 16:39                           ` Serge E. Hallyn
2006-07-14 17:18                             ` Eric W. Biederman
2006-07-14 17:24                               ` Dave Hansen
2006-07-14 18:06                                 ` Eric W. Biederman
2006-07-14 18:42                                   ` Dave Hansen
2006-07-14 19:07                                     ` Eric W. Biederman
2006-07-13 17:59           ` Eric W. Biederman
2006-07-13 21:22             ` Serge E. Hallyn
2006-07-14  3:50               ` Eric W. Biederman
2006-07-14 14:17         ` Serge E. Hallyn
2006-07-14 15:05           ` Eric W. Biederman
2006-07-14 16:46             ` Serge E. Hallyn
2006-07-14 16:58               ` Eric W. Biederman
2006-07-14 15:43           ` Kyle Moffett
2006-07-14 16:13             ` Eric W. Biederman
2006-07-11  7:50 ` [PATCH -mm 6/7] add the user namespace to the execns syscall Cedric Le Goater
2006-07-11  7:50 ` [PATCH -mm 7/7] forbid the use of the unshare syscall on ipc namespaces Cedric Le Goater
2006-07-11 14:10   ` Kirill Korotaev
2006-07-11 15:06     ` Cedric Le Goater
2006-07-11  8:02 ` [PATCH -mm 0/7] execns syscall and user namespace Arjan van de Ven
2006-07-11  8:42   ` Cedric Le Goater
2006-07-11 18:12 ` H. Peter Anvin
2006-07-11 18:26   ` Cedric Le Goater
2006-07-11 18:28     ` H. Peter Anvin
2006-07-11 19:50       ` Ulrich Drepper
2006-07-11 21:50         ` Cedric Le Goater
2006-07-11 21:57           ` H. Peter Anvin
2006-07-12  0:16             ` Ulrich Drepper
2006-07-12  0:25               ` H. Peter Anvin
2006-07-12  0:28           ` H. Peter Anvin
2006-07-11 20:22 ` Eric W. Biederman
2006-07-11 21:28   ` Cedric Le Goater
2006-07-12  3:24     ` Eric W. Biederman
2006-07-12 13:05       ` Cedric Le Goater
2006-07-12 16:56         ` Eric W. Biederman [this message]
2006-07-13 16:13           ` Cedric Le Goater
2006-07-12 11:11   ` Kirill Korotaev
2006-07-12 13:10     ` Cedric Le Goater

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=m11wsqbw49.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=clg@fr.ibm.com \
    --cc=dev@openvz.org \
    --cc=haveblue@us.ibm.com \
    --cc=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam.vilain@catalyst.net.nz \
    --cc=saw@sw.ru \
    --cc=serue@us.ibm.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

Powered by JetHome