All of lore.kernel.org
 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>,
	Colin Cross <ccross@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>,
	Rom Lemarchand <romlem@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 1/2] cgroup: Add generic cgroup subsystem permission checks
Date: Wed, 5 Oct 2016 12:23:34 -0700	[thread overview]
Message-ID: <CAKdAkRS42-qN6wN+kJjnAff2YsFzEDpXW19Tp==aWQbA1Qna8w@mail.gmail.com> (raw)
In-Reply-To: <CALAqxLWUGmMWBu54uRgK2tn9EuCRSDMPHewDmB5DEP+c-WaJEQ@mail.gmail.com>

On Wed, Oct 5, 2016 at 12:16 PM, John Stultz <john.stultz@linaro.org> wrote:
> On Wed, Oct 5, 2016 at 12:09 PM, Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
>> [ Some comments are form Ricky Zhou <rickyz@chromium.org>, some from
>> myself ]
>> On Mon, Oct 03, 2016 at 09:41:29PM -0700, John Stultz wrote:
>>> From: Colin Cross <ccross@android.com>
>>>
> [snip]
>>> +
>>> +             cset = task_css_set(task);
>>
>> Do we need to take css_set_lock here? If not, why?
>>
>>> +             list_add(&cset->mg_node, &tset.src_csets);
>>> +             ret = cgroup_allow_attach(dst_cgrp, &tset);
>>> +             list_del(&tset.src_csets);
>>
>> This should be
>>
>>                 list_del_init(&cset->mg_node);
>>
>> since you are deleting task's cset from the tset list, not other way
>> around. It only happen to work because there is exactly 1 member in
>> tset.src_csets and list_del done on it is exactly list_del_init on the
>> node, so you are not leaving with uncorrupted mg_node in task's cset.
>>
>>> +             if (ret)
>>> +                     ret = -EACCES;
>>> +     }
>>>
>>>       if (!ret && cgroup_on_dfl(dst_cgrp)) {
>>>               struct super_block *sb = of->file->f_path.dentry->d_sb;
>>
>> Isn't this, generally speaking, racy? We take current task's cset and
>> check if we have rights to move it over.  But we do not have any locking
>> between check and actual move, so can the cset change between these 2
>> operations?
>>
>> And if cset can't really change and it is only 1 task, then why do we
>> bother with forming taskset at all? Can we make allow_attach take just
>> the target task argument?
>
> After Tejun's feedback, I've tried reworking the same functionality in
> a much simpler fashion by introducing a new capability bit.
> https://lkml.org/lkml/2016/10/4/479
>
> I believe that approach doesn't have the drawbacks you've pointed out
> here, but would appreciate your input on it.
>
> As for your feedback on this patch, I'll have to look into it a bit,
> as I don't have good answers for you for you right off.  But these do
> seem like valid concerns and since the Android common.git kernels are
> using the code I submitted here, this issues likely need to be fixed
> there.

Yeah, we are looking into the same for ChromeOS, so we have this:

https://chromium-review.googlesource.com/c/393907/

Thanks.

-- 
Dmitry

  reply	other threads:[~2016-10-05 19:23 UTC|newest]

Thread overview: 32+ 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 ` 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:09     ` Dmitry Torokhov
2016-10-05 19:16     ` John Stultz
2016-10-05 19:16       ` John Stultz
2016-10-05 19:23       ` Dmitry Torokhov [this message]
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:10     ` Dmitry Torokhov
2016-10-05 19:18     ` John Stultz
2016-10-05 19:18       ` John Stultz
2016-10-06 22:43       ` Dmitry Torokhov
2016-10-06 22:43         ` Dmitry Torokhov
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 16:16   ` Tejun Heo
2016-10-04 18:01   ` John Stultz
2016-10-04 18:01     ` John Stultz
2016-10-04 19:38     ` Tejun Heo
2016-10-04 19:38       ` Tejun Heo
2016-10-04 19:46       ` John Stultz
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:18         ` Serge E. Hallyn
2016-10-04 20:33         ` Tejun Heo
2016-10-04 21:26           ` Serge E. Hallyn
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='CAKdAkRS42-qN6wN+kJjnAff2YsFzEDpXW19Tp==aWQbA1Qna8w@mail.gmail.com' \
    --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 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.