From: Tejun Heo <tj@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: John Stultz <john.stultz@linaro.org>,
lkml <linux-kernel@vger.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>,
Ricky Zhou <rickyz@chromium.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Todd Kjos <tkjos@google.com>,
Christian Poetzsch <christian.potzsch@imgtec.com>,
Amit Pundir <amit.pundir@linaro.org>,
"Serge E . Hallyn" <serge@hallyn.com>,
Linux API <linux-api@vger.kernel.org>
Subject: Re: [PATCH] cgroup: Add new capability to allow a process to migrate other tasks between cgroups
Date: Wed, 19 Oct 2016 16:51:11 -0400 [thread overview]
Message-ID: <20161019205111.GF3044@htj.duckdns.org> (raw)
In-Reply-To: <CALCETrXrZpLH8NsSmaoH5ChW5+6Zb=nLsznj=x4jeWUjpQ-ecA@mail.gmail.com>
Hello, Andy.
On Mon, Oct 17, 2016 at 03:40:37PM -0700, Andy Lutomirski wrote:
> > @@ -2856,7 +2856,8 @@ static int cgroup_procs_write_permission(struct task_struct *task,
> > */
> > if (!uid_eq(cred->euid, GLOBAL_ROOT_UID) &&
> > !uid_eq(cred->euid, tcred->uid) &&
> > - !uid_eq(cred->euid, tcred->suid))
> > + !uid_eq(cred->euid, tcred->suid) &&
> > + !ns_capable(tcred->user_ns, CAP_CGROUP_MIGRATE))
> > ret = -EACCES;
>
> This logic seems rather confused to me. Without this patch, a user
> can write to procs if it's root *or* it matches the target uid *or* it
> matches the target suid. How does this make sense? How about
> ptrace_may_access(...) || ns_capable(tcred->user_ns,
> CAP_CGROUP_MIGRATE)?
Yeah, it's weird. The problem is that there was no delegation model
defined on v1 and it used a hybrid of file + ptracey access checks.
The goal, I think, was disallowing !root user from pulling in random
tasks into a cgroup it has write access to, which was possible because
there was no isolation on the delegation boundary.
Given how long it has been out in the wild, I don't think changing the
logic is a good idea. We should simply replace GLOBAL_ROOT_UID test
with CAT_WHATEVER_WE_PICK test and just ignore the whole thing on v2.
Thanks.
--
tejun
next prev parent reply other threads:[~2016-10-19 20:51 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-17 22:35 [PATCH] cgroup: Add new capability to allow a process to migrate other tasks between cgroups John Stultz
2016-10-17 22:35 ` John Stultz
[not found] ` <1476743724-9104-1-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-17 22:40 ` Andy Lutomirski
2016-10-17 22:40 ` Andy Lutomirski
2016-10-17 23:35 ` John Stultz
[not found] ` <CALAqxLW0_Xi0vrTkTN+Gmp3yKfOcmCYYCi5f4COgPiYY=odEJA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-18 8:17 ` Michael Kerrisk (man-pages)
2016-10-18 8:17 ` Michael Kerrisk (man-pages)
[not found] ` <CAKgNAkjTYu53ji=gP2qXRYpvUEdAP=gxg0BR40JJ54z+XBha-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-18 16:54 ` John Stultz
2016-10-18 16:54 ` John Stultz
2016-10-19 7:14 ` Michael Kerrisk (man-pages)
2016-10-19 20:52 ` Tejun Heo
2016-10-19 20:52 ` Tejun Heo
[not found] ` <20161019205251.GG3044-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-10-19 20:55 ` John Stultz
2016-10-19 20:55 ` John Stultz
2016-10-19 20:51 ` Tejun Heo [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-12-17 4:43 John Stultz
2016-12-17 4:43 ` John Stultz
[not found] ` <1481949827-23613-1-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-12-17 21:06 ` Mickaël Salaün
2016-12-17 21:06 ` Mickaël Salaün
[not found] ` <5855A8EB.8000005-WFhQfpSGs3bR7s880joybQ@public.gmane.org>
2016-12-19 13:11 ` Tejun Heo
2016-12-19 13:11 ` 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=20161019205111.GF3044@htj.duckdns.org \
--to=tj@kernel.org \
--cc=amit.pundir@linaro.org \
--cc=ccross@android.com \
--cc=cgroups@vger.kernel.org \
--cc=christian.potzsch@imgtec.com \
--cc=corbet@lwn.net \
--cc=dimitrysh@google.com \
--cc=dmitry.torokhov@gmail.com \
--cc=john.stultz@linaro.org \
--cc=kernel-team@android.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=luto@amacapital.net \
--cc=rickyz@chromium.org \
--cc=romlem@android.com \
--cc=serge@hallyn.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.