From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Rom Lemarchand <romlem-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Android Kernel Team
<kernel-team-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
Colin Cross <ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>,
Dmitry Shmidt <dimitrysh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Todd Kjos <tkjos-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Christian Poetzsch
<christian.potzsch-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
Amit Pundir <amit.pundir-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Ricky Zhou <rickyz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Subject: Re: [PATCH 2/2] cgroup: Add a allow_attach policy for Android
Date: Wed, 5 Oct 2016 12:10:56 -0700 [thread overview]
Message-ID: <20161005191056.GB31873@dtor-ws> (raw)
In-Reply-To: <1475556090-6278-3-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
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).
> +
> + if (current != task && !uid_eq(cred->euid, tcred->uid) &&
> + !uid_eq(cred->euid, tcred->suid))
> + return -EACCES;
> + }
> +
> + return 0;
> +}
> +#endif
Thanks.
--
Dmitry
next prev parent reply other threads:[~2016-10-05 19:10 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
[not found] ` <1475556090-6278-2-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
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
[not found] ` <1475556090-6278-3-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-05 19:10 ` Dmitry Torokhov [this message]
2016-10-05 19:18 ` John Stultz
[not found] ` <CALAqxLXxFcLWCbSHiFFy0OEDgbnJY+2OLbgLYvypDwoQMuapHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-06 22:43 ` Dmitry Torokhov
2016-10-06 22:52 ` Dmitry Torokhov
[not found] ` <1475556090-6278-1-git-send-email-john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-10-04 16:16 ` [RFC][PATCH 0/2] Another pass at Android style loosening of cgroup attach permissions Tejun Heo
[not found] ` <20161004161630.GC4205-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
2016-10-04 18:01 ` John Stultz
[not found] ` <CALAqxLUPMxpngbZCSFW9wS+LbZJbfSUxTDEXX2x-FUmuN4H+QQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-04 19:38 ` Tejun Heo
[not found] ` <20161004193838.GH4205-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
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
[not found] ` <20161004203301.GK4205-piEFEHQLUPpN0TnZuCh8vA@public.gmane.org>
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=20161005191056.GB31873@dtor-ws \
--to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amit.pundir-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=ccross-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=christian.potzsch-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
--cc=corbet-T1hC0tSOHrs@public.gmane.org \
--cc=dimitrysh-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=kernel-team-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=rickyz-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=romlem-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tkjos-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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