public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: "John Stultz" <john.stultz@linaro.org>,
	"Mickaël Salaün" <mic@digikod.net>,
	"Daniel Mack" <daniel@zonque.org>,
	"David S. Miller" <davem@davemloft.net>,
	kafai@fb.com, fw@strlen.de, "Harald Hoyer" <harald@redhat.com>,
	"Network Development" <netdev@vger.kernel.org>,
	"Sargun Dhillon" <sargun@sargun.me>,
	"Pablo Neira Ayuso" <pablo@netfilter.org>,
	lkml <linux-kernel@vger.kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Li Zefan" <lizefan@huawei.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"open list:CONTROL GROUP (CGROUP)" <cgroups@vger.kernel.org>,
	"Android Kernel Team" <kernel-team@android.com>,
	"Rom Lemarchand" <romlem@android.com>,
	"Colin Cross" <ccross@android.com>,
	"Dmitry Shmidt" <dimitrysh@google.com>,
	"Todd Kjos" <tkjos@google.com>,
	"Christian Poetzsch" <christian.potzsch@imgtec.com>,
	"Amit Pundir" <amit.pundir@linaro.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Serge E . Hallyn" <serge@hallyn.com>,
	"Linux API" <linux-api@vger.kernel.org>
Subject: Re: [RESEND][PATCH v4] cgroup: Use CAP_SYS_RESOURCE to allow a process to migrate other tasks between cgroups
Date: Tue, 8 Nov 2016 16:03:44 -0800	[thread overview]
Message-ID: <20161109000342.GA42532@ast-mbp.thefacebook.com> (raw)
In-Reply-To: <CALCETrU5fCWoe0RXfKWuN7Zt9vLvoyHFcZnVqeqiKBpSKrMrxA@mail.gmail.com>

On Tue, Nov 08, 2016 at 03:51:40PM -0800, Andy Lutomirski wrote:
> On Tue, Nov 8, 2016 at 3:28 PM, John Stultz <john.stultz@linaro.org> wrote:
> > This patch adds logic to allows a process to migrate other tasks
> > between cgroups if they have CAP_SYS_RESOURCE.
> >
> > In Android (where this feature originated), the ActivityManager tracks
> > various application states (TOP_APP, FOREGROUND, BACKGROUND, SYSTEM,
> > etc), and then as applications change states, the SchedPolicy logic
> > will migrate the application tasks between different cgroups used
> > to control the different application states (for example, there is a
> > background cpuset cgroup which can limit background tasks to stay
> > on one low-power cpu, and the bg_non_interactive cpuctrl cgroup can
> > then further limit those background tasks to a small percentage of
> > that one cpu's cpu time).
> >
> > However, for security reasons, Android doesn't want to make the
> > system_server (the process that runs the ActivityManager and
> > SchedPolicy logic), run as root. So in the Android common.git
> > kernel, they have some logic to allow cgroups to loosen their
> > permissions so CAP_SYS_NICE tasks can migrate other tasks between
> > cgroups.
> >
> > I feel the approach taken there overloads CAP_SYS_NICE a bit much
> > for non-android environments.
> >
> > So this patch, as suggested by Michael Kerrisk, simply adds a
> > check for CAP_SYS_RESOURCE.
> >
> > I've tested this with AOSP master, and this seems to work well
> > as Zygote and system_server already use CAP_SYS_RESOURCE. I've
> > also submitted patches against the android-4.4 kernel to change
> > it to use CAP_SYS_RESOURCE, and the Android developers just merged
> > it.
> >
> 
> I hate to say it, but I think I may see a problem.  Current
> developments are afoot to make cgroups do more than resource control.
> For example, there's Landlock and there's Daniel's ingress/egress
> filter thing.  Current cgroup controllers can mostly just DoS their
> controlled processes.  These new controllers (or controller-like
> things) can exfiltrate data and change semantics.
> 
> Does anyone have a security model in mind for these controllers and
> the cgroups that they're attached to?  I'm reasonably confident that
> CAP_SYS_RESOURCE is not the answer...

and specifically the answer is... ?
Also would be great if you start with specifying the question first
and the problem you're trying to solve.

  reply	other threads:[~2016-11-09  0:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 23:28 [RESEND][PATCH v4] cgroup: Use CAP_SYS_RESOURCE to allow a process to migrate other tasks between cgroups John Stultz
2016-11-08 23:41 ` Kees Cook
2016-11-08 23:51 ` Andy Lutomirski
2016-11-09  0:03   ` Alexei Starovoitov [this message]
2016-11-09  0:12     ` Andy Lutomirski
2016-11-23  0:57       ` John Stultz
2016-12-06  0:28         ` John Stultz
2016-12-06  0:36           ` Andy Lutomirski
2016-12-06  2:00             ` Serge E. Hallyn
2016-12-06 16:57               ` Tejun Heo
2016-12-06 16:55             ` Tejun Heo
2016-12-06 17:01               ` Andy Lutomirski
2016-12-06 18:12                 ` Tejun Heo
2016-12-06 18:13                   ` Andy Lutomirski
2016-12-06 18:23                     ` Tejun Heo
2016-12-09  5:39                       ` John Stultz
2016-12-09 13:27                         ` Tejun Heo

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=20161109000342.GA42532@ast-mbp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=amit.pundir@linaro.org \
    --cc=ccross@android.com \
    --cc=cgroups@vger.kernel.org \
    --cc=christian.potzsch@imgtec.com \
    --cc=corbet@lwn.net \
    --cc=daniel@zonque.org \
    --cc=davem@davemloft.net \
    --cc=dimitrysh@google.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=fw@strlen.de \
    --cc=harald@redhat.com \
    --cc=john.stultz@linaro.org \
    --cc=kafai@fb.com \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=luto@kernel.org \
    --cc=mic@digikod.net \
    --cc=netdev@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=romlem@android.com \
    --cc=sargun@sargun.me \
    --cc=serge@hallyn.com \
    --cc=tj@kernel.org \
    --cc=tkjos@google.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