[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAADnVQ+hP9xYH2f4hiUtEcG8NGETTO7BicbRfpd9zxMPnosLHg@mail.gmail.com>
Date: Thu, 29 May 2025 09:46:49 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Jiayuan Chen <jiayuan.chen@...ux.dev>
Cc: bpf <bpf@...r.kernel.org>,
syzbot+9767c7ed68b95cfa69e6@...kaller.appspotmail.com,
Alexei Starovoitov <ast@...nel.org>, Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin KaFai Lau <martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>, John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>, Shuah Khan <shuah@...nel.org>,
Feng Yang <yangfeng@...inos.cn>, Tejun Heo <tj@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK" <linux-kselftest@...r.kernel.org>
Subject: Re: [PATCH bpf-next v1 1/2] bpf: Restrict usage scope of bpf_get_cgroup_classid
On Wed, May 28, 2025 at 9:17 AM Jiayuan Chen <jiayuan.chen@...ux.dev> wrote:
>
> A previous commit expanded the usage scope of bpf_get_cgroup_classid() to
> all contexts (see Fixes tag), but this was inappropriate.
>
> First, syzkaller reported a bug [1].
> Second, it uses skb as an argument, but its implementation varies across
> different bpf prog types. For example, in sock_filter and sock_addr, it
> retrieves the classid from the current context
> (bpf_get_cgroup_classid_curr_proto) instead of from skb. In tc egress and
> lwt, it fetches the classid from skb->sk, but in tc ingress, it returns 0.
>
> In summary, the definition of bpf_get_cgroup_classid() is ambiguous and
> its usage scenarios are limited. It should not be treated as a
> general-purpose helper. This patch reverts part of the previous commit.
I think it's better to make it generic enough instead
of reintroducing a bunch of prog specific proto handlers.
See this discussion:
https://lore.kernel.org/bpf/20250528020755.33182-1-yangfeng59949@163.com/
pw-bot: cr
Powered by blists - more mailing lists