BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Chuyi Zhou <zhouchuyi@bytedance.com>, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	martin.lau@kernel.org
Subject: Re: [PATCH bpf-next v3 1/3] bpf: Relax allowlist for css_task iter
Date: Mon, 30 Oct 2023 17:05:16 -0700	[thread overview]
Message-ID: <ca7e896b-328b-454e-ad97-fc824df562af@linux.dev> (raw)
In-Reply-To: <20231025075914.30979-2-zhouchuyi@bytedance.com>


On 10/25/23 12:59 AM, Chuyi Zhou wrote:
> The newly added open-coded css_task iter would try to hold the global
> css_set_lock in bpf_iter_css_task_new, so the bpf side has to be careful in
> where it allows to use this iter. The mainly concern is dead locking on
> css_set_lock. check_css_task_iter_allowlist() in verifier enforced css_task
> can only be used in bpf_lsm hooks and sleepable bpf_iter.
>
> This patch relax the allowlist for css_task iter. Any lsm and any iter
> (even non-sleepable) and any sleepable are safe since they would not hold
> the css_set_lock before entering BPF progs context.
>
> This patch also fixes the misused BPF_TRACE_ITER in
> check_css_task_iter_allowlist which compared bpf_prog_type with
> bpf_attach_type.
>
> Fixes: 9c66dc94b62ae ("bpf: Introduce css_task open-coded iterator kfuncs")
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>

Acked-by: Yonghong Song <yonghong.song@linux.dev>


  reply	other threads:[~2023-10-31  0:05 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  7:59 [PATCH bpf-next v3 0/3] Relax allowlist for open-coded css_task iter Chuyi Zhou
2023-10-25  7:59 ` [PATCH bpf-next v3 1/3] bpf: Relax allowlist for " Chuyi Zhou
2023-10-31  0:05   ` Yonghong Song [this message]
2023-10-25  7:59 ` [PATCH bpf-next v3 2/3] selftests/bpf: Add tests for css_task iter combining with cgroup iter Chuyi Zhou
2023-10-31  0:14   ` Yonghong Song
2023-10-25  7:59 ` [PATCH bpf-next v3 3/3] selftests/bpf: Add test for using css_task iter in sleepable progs Chuyi Zhou
2023-10-31  0:20   ` Yonghong Song
2023-10-31  2:28     ` Chuyi Zhou
2023-10-31  2:41       ` Yonghong Song

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=ca7e896b-328b-454e-ad97-fc824df562af@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=martin.lau@kernel.org \
    --cc=zhouchuyi@bytedance.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