BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@meta.com>
To: Hou Tao <houtao@huaweicloud.com>,
	bpf@vger.kernel.org, Hao Luo <haoluo@google.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Stanislav Fomichev <sdf@google.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
	Yonghong Song <yhs@fb.com>,
	Daniel Borkmann <daniel@iogearbox.net>,
	KP Singh <kpsingh@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Tejun Heo <tj@kernel.org>,
	houtao1@huawei.com
Subject: Re: [PATCH bpf 0/3] Pin the start cgroup for cgroup iterator
Date: Mon, 7 Nov 2022 14:51:53 -0800	[thread overview]
Message-ID: <ddf788e1-ba97-4b5c-4cf2-5c79fc91b17e@meta.com> (raw)
In-Reply-To: <20221107074222.1323017-1-houtao@huaweicloud.com>



On 11/6/22 11:42 PM, Hou Tao wrote:
> From: Hou Tao <houtao1@huawei.com>
> 
> Hi,
> 
> The patchset tries to fix the potential use-after-free problem in cgroup
> iterator. The problem is similar with the UAF problem fixed in map
> iterator and the fixes is also similar: pinning the iterated resource
> in .init_seq_private() and unpinning in .fini_seq_private(). Also adding
> a test to demonstrate the problem.
> 
> Not sure whether or not it will be helpful to add some comments for
> .init_seq_private() to state that the implementation of
> .init_seq_private() should not depend on iterator link to guarantee
> the liveness of iterated object. Comments are always welcome.

You added some comments in cgroup_iter init_seq_private(). Hopefully
that can serve as an example so for future iterators we can search
the code and remember to hold necessary references in init_seq_private()
function....

> 
> Hou Tao (3):
>    bpf: Pin the start cgroup in cgroup_iter_seq_init()
>    selftests/bpf: Add cgroup helper remove_cgroup()
>    selftests/bpf: Add test for cgroup iterator on a dead cgroup
> 
>   kernel/bpf/cgroup_iter.c                      | 14 ++++
>   tools/testing/selftests/bpf/cgroup_helpers.c  | 19 +++++
>   tools/testing/selftests/bpf/cgroup_helpers.h  |  1 +
>   .../selftests/bpf/prog_tests/cgroup_iter.c    | 78 +++++++++++++++++++
>   4 files changed, 112 insertions(+)
> 

  parent reply	other threads:[~2022-11-07 22:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07  7:42 [PATCH bpf 0/3] Pin the start cgroup for cgroup iterator Hou Tao
2022-11-07  7:42 ` [PATCH bpf 1/3] bpf: Pin the start cgroup in cgroup_iter_seq_init() Hou Tao
2022-11-07 21:59   ` Yonghong Song
2022-11-08  2:11     ` Hao Luo
2022-11-08  4:08       ` Hou Tao
2022-11-08  7:03         ` Yonghong Song
2022-11-08 13:28           ` Hou Tao
2022-11-08 16:19             ` Yonghong Song
2022-11-09  9:30               ` Hou Tao
2022-11-08 18:10             ` Hao Luo
2022-11-07  7:42 ` [PATCH bpf 2/3] selftests/bpf: Add cgroup helper remove_cgroup() Hou Tao
2022-11-07 22:10   ` Yonghong Song
2022-11-07  7:42 ` [PATCH bpf 3/3] selftests/bpf: Add test for cgroup iterator on a dead cgroup Hou Tao
2022-11-07 22:44   ` Yonghong Song
2022-11-08  0:39     ` Hou Tao
2022-11-07 22:51 ` Yonghong Song [this message]
2022-11-08  0:46   ` [PATCH bpf 0/3] Pin the start cgroup for cgroup iterator Hou Tao

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=ddf788e1-ba97-4b5c-4cf2-5c79fc91b17e@meta.com \
    --to=yhs@meta.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=haoluo@google.com \
    --cc=houtao1@huawei.com \
    --cc=houtao@huaweicloud.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@google.com \
    --cc=song@kernel.org \
    --cc=tj@kernel.org \
    --cc=yhs@fb.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