All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny@suse.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Cgroups <cgroups@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	Tejun Heo <tj@kernel.org>, Aditya Kali <adityakali@google.com>,
	Serge Hallyn <serge.hallyn@canonical.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Yonghong Song <yhs@fb.com>,
	Muneendra Kumar <muneendra.kumar@broadcom.com>,
	Hao Luo <haoluo@google.com>
Subject: Re: [PATCH 4/4] cgroup/bpf: Honor cgroup NS in cgroup_iter for ancestors
Date: Mon, 29 Aug 2022 14:59:57 +0200	[thread overview]
Message-ID: <20220829125957.GB3579@blackbody.suse.cz> (raw)
In-Reply-To: <CAJD7tkZZ6j6mPfwwFDy_ModYux5447HFP=oPwa6MFA_NYAZ9-g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Fri, Aug 26, 2022 at 10:41:37AM -0700, Yosry Ahmed <yosryahmed@google.com> wrote:
> I understand that currently cgroup_iter is the only user of this, but
> for future use cases, is it safe to assume that cgrp will always be
> inside ns? Would it be safer to do something like:

I preferred the simpler root_cgrp comparison to avoid pointer
arithmetics in cgroup_is_descendant. But I also made the assumption of
cgrp in ns.

Thanks, I'll likely adjust cgroup_path_ns to make it more robust for
an external cgrp.


I'd like to clarify, if a process A in a broad cgroup ns sets up a BPF
cgroup iterator, exposes it via bpffs and than a process B in a narrowed
cgroup ns (which excludes the origin cgroup) wants to traverse the
iterator, should it fail straight ahead (regardless of iter order)?
The alternative would be to allow self-dereference but prohibit any
iterator moves (regardless of order).


Thanks,
Michal

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>
To: Yosry Ahmed <yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Linux Kernel Mailing List
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Cgroups <cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	bpf <bpf-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Aditya Kali <adityakali-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Serge Hallyn
	<serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
	Roman Gushchin
	<roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>,
	Yonghong Song <yhs-b10kYP2dOMg@public.gmane.org>,
	Muneendra Kumar
	<muneendra.kumar-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>,
	Hao Luo <haoluo-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH 4/4] cgroup/bpf: Honor cgroup NS in cgroup_iter for ancestors
Date: Mon, 29 Aug 2022 14:59:57 +0200	[thread overview]
Message-ID: <20220829125957.GB3579@blackbody.suse.cz> (raw)
In-Reply-To: <CAJD7tkZZ6j6mPfwwFDy_ModYux5447HFP=oPwa6MFA_NYAZ9-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

On Fri, Aug 26, 2022 at 10:41:37AM -0700, Yosry Ahmed <yosryahmed-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
> I understand that currently cgroup_iter is the only user of this, but
> for future use cases, is it safe to assume that cgrp will always be
> inside ns? Would it be safer to do something like:

I preferred the simpler root_cgrp comparison to avoid pointer
arithmetics in cgroup_is_descendant. But I also made the assumption of
cgrp in ns.

Thanks, I'll likely adjust cgroup_path_ns to make it more robust for
an external cgrp.


I'd like to clarify, if a process A in a broad cgroup ns sets up a BPF
cgroup iterator, exposes it via bpffs and than a process B in a narrowed
cgroup ns (which excludes the origin cgroup) wants to traverse the
iterator, should it fail straight ahead (regardless of iter order)?
The alternative would be to allow self-dereference but prohibit any
iterator moves (regardless of order).


Thanks,
Michal

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2022-08-29 13:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26 16:52 [PATCH 0/4] Honor cgroup namespace when resolving cgroup id Michal Koutný
2022-08-26 16:52 ` Michal Koutný
2022-08-26 16:52 ` [PATCH 1/4] cgroup: Honor caller's cgroup NS when resolving path Michal Koutný
2022-08-26 16:52   ` Michal Koutný
2022-08-26 16:52 ` [PATCH 2/4] cgroup: cgroup: Honor caller's cgroup NS when resolving cgroup id Michal Koutný
2022-08-26 16:52   ` Michal Koutný
2022-08-26 16:52 ` [PATCH 3/4] cgroup: Homogenize cgroup_get_from_id() return value Michal Koutný
2022-08-26 16:52   ` Michal Koutný
2022-08-26 16:52 ` [PATCH 4/4] cgroup/bpf: Honor cgroup NS in cgroup_iter for ancestors Michal Koutný
2022-08-26 16:52   ` Michal Koutný
2022-08-26 17:41   ` Yosry Ahmed
2022-08-29 12:59     ` Michal Koutný [this message]
2022-08-29 12:59       ` Michal Koutný
2022-08-29 17:30       ` Yosry Ahmed
2022-08-29 17:30         ` Yosry Ahmed
2022-08-29 17:49         ` Tejun Heo
2022-08-29 18:02           ` Hao Luo
2022-08-26 20:59 ` [PATCH 0/4] Honor cgroup namespace when resolving cgroup id Tejun Heo
2022-08-26 21:08 ` 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=20220829125957.GB3579@blackbody.suse.cz \
    --to=mkoutny@suse.com \
    --cc=adityakali@google.com \
    --cc=bpf@vger.kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=haoluo@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=muneendra.kumar@broadcom.com \
    --cc=roman.gushchin@linux.dev \
    --cc=serge.hallyn@canonical.com \
    --cc=tj@kernel.org \
    --cc=yhs@fb.com \
    --cc=yosryahmed@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.