From: Christian Brauner <christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
To: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v4 1/6] cgroup: unify attach permission checking
Date: Mon, 20 Jan 2020 15:46:28 +0100 [thread overview]
Message-ID: <20200120144627.2ttqolx3md6vyfew@wittgenstein> (raw)
In-Reply-To: <20200120144244.GD30403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Mon, Jan 20, 2020 at 03:42:45PM +0100, Oleg Nesterov wrote:
> I guess I am totally confused, but...
>
> On 01/17, Christian Brauner wrote:
> >
> > +static inline bool cgroup_same_domain(const struct cgroup *src_cgrp,
> > + const struct cgroup *dst_cgrp)
> > +{
> > + return src_cgrp->dom_cgrp == dst_cgrp->dom_cgrp;
> > +}
> > +
> > +static int cgroup_attach_permissions(struct cgroup *src_cgrp,
> > + struct cgroup *dst_cgrp,
> > + struct super_block *sb, bool thread)
> > +{
> > + int ret = 0;
> > +
> > + ret = cgroup_procs_write_permission(src_cgrp, dst_cgrp, sb);
> > + if (ret)
> > + return ret;
> > +
> > + ret = cgroup_migrate_vet_dst(dst_cgrp);
> > + if (ret)
> > + return ret;
> > +
> > + if (thread &&
> > + !cgroup_same_domain(src_cgrp->dom_cgrp, dst_cgrp->dom_cgrp))
> ^^^^^^^^^^ ^^^^^^^^^^
>
> cgroup_same_domain(src_cgrp, dst_cgrp)
>
> no?
>
> And given that cgroup_same_domain() has no other users, perhaps it can
> simply check
>
> src_cgrp->dom_cgrp != dst_cgrp->dom_cgrp
Yeah, I just added it because the helper is very descriptive given its
name. Maybe too descriptive given my braino.
I'll just remove it in favor of this check and give it a small comment.
Thanks!
Christian
next prev parent reply other threads:[~2020-01-20 14:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200117181219.14542-1-christian.brauner@ubuntu.com>
[not found] ` <20200117181219.14542-1-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2020-01-17 18:12 ` [PATCH v4 1/6] cgroup: unify attach permission checking Christian Brauner
[not found] ` <20200117181219.14542-2-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2020-01-20 14:42 ` Oleg Nesterov
[not found] ` <20200120144244.GD30403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2020-01-20 14:46 ` Christian Brauner [this message]
2020-01-17 18:12 ` [PATCH v4 2/6] cgroup: add cgroup_get_from_file() helper Christian Brauner
2020-01-17 18:12 ` [PATCH v4 3/6] cgroup: refactor fork helpers Christian Brauner
2020-01-20 14:00 ` Oleg Nesterov
2020-01-20 14:04 ` Christian Brauner
2020-01-20 14:22 ` Oleg Nesterov
[not found] ` <20200120142202.GC30403-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2020-01-20 14:33 ` Christian Brauner
2020-01-17 18:12 ` [PATCH v4 4/6] cgroup: add cgroup_may_write() helper Christian Brauner
2020-01-17 18:12 ` [PATCH v4 5/6] clone3: allow spawning processes into cgroups Christian Brauner
[not found] ` <20200117181219.14542-6-christian.brauner-GeWIH/nMZzLQT0dZR+AlfA@public.gmane.org>
2020-01-20 15:39 ` Oleg Nesterov
2020-01-20 21:38 ` Christian Brauner
2020-01-17 18:12 ` [PATCH v4 6/6] selftests/cgroup: add tests for cloning " Christian Brauner
2020-01-17 20:24 ` Roman Gushchin
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=20200120144627.2ttqolx3md6vyfew@wittgenstein \
--to=christian.brauner-gewih/nmzzlqt0dzr+alfa@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@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