Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: "Bruno Prémont"
	<bonbons-ud5FBsm0p/xEiooADzr8i9i2O/JbrIOy@public.gmane.org>
Cc: Corey Minyard <cminyard-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Linux Kernel
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Corey Minyard <minyard-HInyCGIudOg@public.gmane.org>
Subject: Re: [PATCH] Move console redirect to pid namespace
Date: Wed, 13 Feb 2013 11:08:23 -0800	[thread overview]
Message-ID: <87r4kkuj4o.fsf@xmission.com> (raw)
In-Reply-To: <20130209191409.643c3d7f-hY15tx4IgV39zxVx7UNMDg@public.gmane.org> ("Bruno \=\?utf-8\?Q\?Pr\?\= \=\?utf-8\?Q\?\=C3\=A9mont\=22's\?\= message of "Sat, 9 Feb 2013 19:14:09 +0100")

Bruno Prémont <bonbons@linux-vserver.org> writes:

> CCing containers list
>
> On Fri, 08 February 2013 minyard@acm.org wrote:
>> From: Corey Minyard <cminyard@mvista.com>
>> 
>> The console redirect - ioctl(fd, TIOCCONS) - is not in a namespace,
>> thus a container can do a redirect and grab all the I/O on the host
>> and all container consoles.
>> 
>> This change puts the redirect in the pid namespace.
>> 
>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>> ---
>> 
>> I'm pretty sure this patch is not correct, but I'm not quite sure the
>> best way to fix this.  I'm not 100% sure that the pid namespace is the
>> right place, but it seemed the most reasonable of all the choices.  The
>> other obvious choice is the mount namespace, but it didn't seem as good
>> a fit.
>
> With recent changes, tying it to init user namespace might even be
> better.

With recent changes this is tied to the initial user namespace.  So the
simple solution to this and so many other similiar security problems is
to run your container in a user namespace.

The permission check currently is capable(CAP_SYS_ADMIN) which requires
the caller to have the CAP_SYS_ADMIN in the initial user namespace.

Is there a desire to have TIOCCONS not just fail in a container but to
have TIOCCONS work in a container specific way?

>> The other problem is that I don't think you can call fput() from
>> destroy_pid_namespace().  That can be called from interrupt context,
>> and I don't think fput() is safe there.  I know it's not safe in 3.4
>> with the RT patch applied.  However, the only way I've come up with to
>> fix it is to add a workqueue, and that seems a bit heavy for this.

Actually getting destroy_pid_namespace out of interrupt context wouldn't
be the worst thing in the world.

Eric
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers

  parent reply	other threads:[~2013-02-13 19:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1360376920-30824-1-git-send-email-minyard@acm.org>
     [not found] ` <1360376920-30824-1-git-send-email-minyard-HInyCGIudOg@public.gmane.org>
2013-02-09 18:14   ` [PATCH] Move console redirect to pid namespace Bruno Prémont
     [not found]     ` <20130209191409.643c3d7f-hY15tx4IgV39zxVx7UNMDg@public.gmane.org>
2013-02-13 19:08       ` Eric W. Biederman [this message]
     [not found]         ` <87r4kkuj4o.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-02-15  2:08           ` Corey Minyard
     [not found]             ` <511D9890.1040900-HInyCGIudOg@public.gmane.org>
2013-02-15  4:23               ` Eric W. Biederman
     [not found]                 ` <87d2w29pdo.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-02-15 14:50                   ` Corey Minyard

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=87r4kkuj4o.fsf@xmission.com \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=bonbons-ud5FBsm0p/xEiooADzr8i9i2O/JbrIOy@public.gmane.org \
    --cc=cminyard-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=minyard-HInyCGIudOg@public.gmane.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