mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: John Stultz <john.stultz@linaro.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Rom Lemarchand <romlem@android.com>, Tejun Heo <tj@kernel.org>,
	Li Zefan <lizefan@huawei.com>, Jonathan Corbet <corbet@lwn.net>,
	cgroups@vger.kernel.org,
	Android Kernel Team <kernel-team@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>,
	Ricky Zhou <rickyz@chromium.org>
Subject: Re: [PATCH 2/2] cgroup: Add a allow_attach policy for Android
Date: Thu, 6 Oct 2016 15:43:51 -0700	[thread overview]
Message-ID: <20161006224351.GA25887@dtor-ws> (raw)
In-Reply-To: <CALAqxLXxFcLWCbSHiFFy0OEDgbnJY+2OLbgLYvypDwoQMuapHg@mail.gmail.com>

On Wed, Oct 05, 2016 at 12:18:17PM -0700, John Stultz wrote:
> On Wed, Oct 5, 2016 at 12:10 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> > On Mon, Oct 03, 2016 at 09:41:30PM -0700, John Stultz wrote:
> >> +#ifdef CONFIG_CGROUP_NICE_ATTACH
> >> +int cgroup_nice_allow_attach(struct cgroup_taskset *tset)
> >> +{
> >> +     const struct cred *cred = current_cred(), *tcred;
> >> +     struct task_struct *task;
> >> +     struct cgroup_subsys_state *css;
> >> +
> >> +     if (capable(CAP_SYS_NICE))
> >> +             return 0;
> >> +
> >> +     cgroup_taskset_for_each(task, css, tset) {
> >> +             tcred = __task_cred(task);
> >
> > __task_cred() requires RCU lock (courtesy Ricky Z).
> 
> Again, hopefully this isn't an issue with the new approach, but for
> the short term I'll see if we can get this fixed in the android tree.
> 

Actually, it should all be simply removed from there right away, as this
ends up being basically noop (but with all the locking violations and
races):

cgroup_taskset_for_each() needs tasks to be placed on cset->mg_tasks
list, but nobody does this in the ->allow_access() code path, so this
loops always executes exactly 0 times and the whole thing is exactly
equivalent of doing

	return capable(CAP_SYS_NICE) ? 0 : -EACESS;

which can be done right in cgroup_procs_write_permission().

Thanks.

-- 
Dmitry

  reply	other threads:[~2016-10-06 22:44 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04  4:41 [RFC][PATCH 0/2] Another pass at Android style loosening of cgroup attach permissions John Stultz
2016-10-04  4:41 ` [PATCH 1/2] cgroup: Add generic cgroup subsystem permission checks John Stultz
2016-10-05 19:09   ` Dmitry Torokhov
2016-10-05 19:16     ` John Stultz
2016-10-05 19:23       ` Dmitry Torokhov
2016-10-04  4:41 ` [PATCH 2/2] cgroup: Add a allow_attach policy for Android John Stultz
2016-10-05 19:10   ` Dmitry Torokhov
2016-10-05 19:18     ` John Stultz
2016-10-06 22:43       ` Dmitry Torokhov [this message]
2016-10-06 22:52         ` Dmitry Torokhov
2016-10-04 16:16 ` [RFC][PATCH 0/2] Another pass at Android style loosening of cgroup attach permissions Tejun Heo
2016-10-04 18:01   ` John Stultz
2016-10-04 19:38     ` Tejun Heo
2016-10-04 19:46       ` John Stultz
2016-10-04 19:49         ` Tejun Heo
2016-10-04 20:18       ` Serge E. Hallyn
2016-10-04 20:33         ` Tejun Heo
2016-10-04 21:26           ` Serge E. Hallyn
2016-10-04 21:29             ` Tejun Heo
2016-10-04 18:03   ` John Stultz

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=20161006224351.GA25887@dtor-ws \
    --to=dmitry.torokhov@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=dimitrysh@google.com \
    --cc=john.stultz@linaro.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=rickyz@chromium.org \
    --cc=romlem@android.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

Powered by JetHome