netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Grzegorz Nosek <root@localdomain.pl>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Grzegorz Nosek <root@localdomain.pl>,
	containers@lists.osdl.org, netdev@vger.kernel.org
Subject: Re: [RFC][PATCH] IP address restricting cgroup subsystem
Date: Wed, 7 Jan 2009 10:16:00 +0100	[thread overview]
Message-ID: <20090107091600.GA17612@megiteam.pl> (raw)
In-Reply-To: <49646993.6080802@cn.fujitsu.com>

On śro, sty 07, 2009 at 04:36:35 +0800, Li Zefan wrote:
> Grzegorz Nosek wrote:
> >>> IP addresses are write-once (via /cgroup/.../ipaddr.ipv4 in dotted-quad
> >> Why they should be write-once ?
> > 
> > No real (technical) reason. Making it read-write would be fine with me.
> > I wanted to make the restriction a one-way road but I guess I can police
> > that in userspace (simply don't write anything to the file twice).
> > 
> 
> But seems the patch makes it impossible to re-allow a restricted task to
> be binded to INADDR_ANY.

Yes, my goal is to disallow that but I don't insist to do that in the
kernel (I'm not currently planning to let untrusted root loose in a
container).

> Firstly, is inheritance necessary ?

It would be nice to have when the container's root is untrusted but
might want to subdivide the container's cgroup for other purposes.
Without inheritance, they would be able to circumvent the IP address
restriction. One could argue that a full untrusted-root container would
need a proper network namespace anyway (and giving CAP_SYS_ADMIN there
is probably a very bad idea), but still, I'd feel uneasy.

> If yes, then how about:
> 
> The root cgroup is read-only, so the tasks in it always bind to INADDR_ANY.
> For other cgroups, write is allowed only if it has no children and the
> parent is INADDR_ANY.

Yes, I like that. Will update the patch. I assume that I must check
list_empty(&cgroup->children)? Should I use cgroup_lock()/cgroup_unlock()
or other locking? I think it will be safe to do without locks but would
rather get some expert advice.

Thanks a lot for your comments.

Best regards,
 Grzegorz Nosek

  reply	other threads:[~2009-01-07  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090106230554.GB25228@eskarina.localdomain.pl>
     [not found] ` <20090106230554.GB25228-IaEwMO9oKu/77SC2UrCW1JJg/dWx8T/9@public.gmane.org>
2009-01-07  6:01   ` [RFC][PATCH] IP address restricting cgroup subsystem Li Zefan
     [not found]     ` <49644526.8030205-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2009-01-07  7:38       ` Grzegorz Nosek
2009-01-07  8:36         ` Li Zefan
2009-01-07  9:16           ` Grzegorz Nosek [this message]
2009-01-07  9:33             ` Li Zefan
2009-01-07  9:37               ` Grzegorz Nosek
2009-01-09 21:38               ` [Devel] " Paul Menage
2009-01-10  4:50                 ` Li Zefan
2009-01-10 16:14                   ` Paul Menage
2009-01-12  2:20                     ` Li Zefan
2009-01-14  2:07                       ` Paul Menage
2009-01-14  2:47                         ` Li Zefan
2009-01-14  2:50                           ` Paul Menage

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=20090107091600.GA17612@megiteam.pl \
    --to=root@localdomain.pl \
    --cc=containers@lists.osdl.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).