Linux Container Development
 help / color / mirror / Atom feed
From: ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org (Eric W. Biederman)
To: Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
Cc: Linux Containers
	<containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org>,
	Paul Menage <menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC][PATCH] Devices visibility container
Date: Tue, 25 Sep 2007 07:43:53 -0600	[thread overview]
Message-ID: <m1lkaudfmu.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <46F8FE34.4020703-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org> (Cedric Le Goater's message of "Tue, 25 Sep 2007 14:25:24 +0200")

Cedric Le Goater <clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org> writes:

> Hello Eric !
>
> Eric W. Biederman wrote:
>> Pavel Emelyanov <xemul-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org> writes:
>> 
>>> At KS we have pointed out the need in some container, that allows
>>> to limit the visibility of some devices to task within it. I.e.
>>> allow for /dev/null, /dev/zero etc, but disable (by default) some
>>> IDE devices or SCSI discs and so on.
>> 
>> NAK
>> 
>> We do not want a control group subsystem for this.
>
> we will need one way to configure the list of available devices from
> user space. Any proposal ?

Proposal 1/2.  From the kernel side we have.
dev_ns_add(kdev_t cur_dev, struct dev_ns *target_ns, kdev_t target_kdev)
Which looks up the device and add it to the hash tables in the proper
device namespace, and fires off the appropriate hotplug events.

I guess the easy user space interface would be:
echo <device_ns_pid>:<major>:<minor> > /sys/block/ram0/dev

Although I suspect that we want some restrictions on what
combinations of major and minor numbers are valid.

Despite the fact that my gut says writeable sysfs files were
a bad idea.  Since we have them my gut says sysfs the filesystem
of devices is where we need the control files for devices.

>> For the short term we can just drop CAP_SYS_MKNOD.
>
> Sure. Pavel is working on something mid-term ;)

Well.  I don't think midterm is mergeable, I do think it is good
for conversation though.  I also don't see why what Pavel is doing
can't be implemented as a device namespace.

>> For the long term we need a device namespace for application
>> migration, so they can continue to use devices with the same
>> major+minor number pair after the migration event.   
>
> Hmm, yes. I can imagine that for some big database application using
> raw devices but it only means that the same device must be present
> upon restart. I don't see any identifier virtualization issues.

Well there is the classic one.  You are migrating to a machine which
is using that major+minor number for a different device already.

Especially in the cases like network block devices or SCSI talking
to SAN, we can talk to the same device and still have a different
major+minor number after migration in the current setup.

I think we can hit similar issues with ttys, loopback devices,
and ramdisks as well.

>> Things like
>> ensuring a call to stat on a given file before and after the migration
>> return the exact same information sounds compelling.  So I don't think
>> this is even strictly limited to virtual devices anymore. How many
>> applications are there out there that memorize the stat data on a file
>> and so they can detect if it has changed?
>
> that we need to support of course, otherwise we would break things 
> like tail. 

Exactly. tail, git, backup software.
All kinds of infrequently run but interesting software.

>> If we need something between those two it may make sense to enhance
>> the LSM or perhaps introduce an alternate set security hooks.  Still
>> if we are going to need a full device namespace that may be a little
>> much.
>
> serge's implementation using security hooks should help us choose
> the right approach. 

Sure.

Currently I have to agree with Alan Cox that our biggest security
need seems to be a good implementation of revoke in the kernel.
So we can do things like ensure a device is not being used by anyone
else.  For removal of character and block devices we may not need a
general thing but it is worth looking at.

Eric

  parent reply	other threads:[~2007-09-25 13:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-24  8:28 [RFC][PATCH] Devices visibility container Pavel Emelyanov
     [not found] ` <46F77523.9020001-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-24  9:55   ` Cedric Le Goater
     [not found]     ` <46F78982.2000901-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2007-09-24 11:47       ` Pavel Emelyanov
2007-09-24 14:39   ` Serge E. Hallyn
     [not found]     ` <20070924143915.GA30195-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-09-24 14:58       ` Pavel Emelyanov
     [not found]         ` <46F7D082.7090304-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-24 15:20           ` Serge E. Hallyn
     [not found]             ` <20070924152001.GB30195-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-09-24 15:31               ` Pavel Emelyanov
     [not found]                 ` <46F7D86D.3060106-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-24 15:51                   ` Serge E. Hallyn
     [not found]                     ` <20070924155139.GC30195-6s5zFf/epYLPQpwDFJZrxKsjOiXwFzmk@public.gmane.org>
2007-09-24 15:57                       ` Cedric Le Goater
     [not found]                         ` <46F7DE58.1020505-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2007-09-24 16:18                           ` Serge E. Hallyn
2007-09-24 15:32               ` Kirill Korotaev
     [not found]                 ` <46F7D8A6.8040303-3ImXcnM4P+0@public.gmane.org>
2007-09-24 16:53                   ` Serge E. Hallyn
2007-09-24 16:47   ` Eric W. Biederman
     [not found]     ` <m1r6kodn7t.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-09-25  7:48       ` Pavel Emelyanov
     [not found]         ` <46F8BD33.5040108-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-25 13:30           ` Eric W. Biederman
     [not found]             ` <m13ax2eut7.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-09-26 15:36               ` Dave Hansen
2007-09-26 19:09                 ` Eric W. Biederman
     [not found]                   ` <m1641xuttx.fsf-T1Yj925okcoyDheHMi7gv2pdwda3JcWeAL8bYrjMMd8@public.gmane.org>
2007-09-27 15:46                     ` Dave Hansen
2007-09-25 12:25       ` Cedric Le Goater
     [not found]         ` <46F8FE34.4020703-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org>
2007-09-25 13:43           ` Eric W. Biederman [this message]
2007-09-25  7:53   ` Paul Menage
     [not found]     ` <6599ad830709250053m715a1848mf6c17a6dd321092-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-09-25  8:00       ` Pavel Emelyanov
     [not found]         ` <46F8C007.1090000-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2007-09-25 11:20           ` 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=m1lkaudfmu.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm-as9lmozglivwk0htik3j/w@public.gmane.org \
    --cc=clg-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
    --cc=menage-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=xemul-GEFAQzZX7r8dnm+yROfE0A@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