From: Leon Hwang <leon.hwang@linux.dev>
To: Sanghyun Park <sanghyun.park.cnu@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
bpf@vger.kernel.org
Cc: John Fastabend <john.fastabend@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Stanislav Fomichev <sdf@fomichev.me>,
Pu Lehui <pulehui@huawei.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v3] bpf: Fix stack out-of-bounds write in cgroup link update
Date: Fri, 21 Aug 2026 21:41:29 +0800 [thread overview]
Message-ID: <1ab678ef-6349-4374-9ebf-22f857211ca7@linux.dev> (raw)
In-Reply-To: <20260821084726.3769957-2-sanghyun.park.cnu@gmail.com>
On 2026/8/21 16:47, Sanghyun Park wrote:
[...]
>
> @@ -5968,6 +5975,22 @@ static int link_update(union bpf_attr *attr)
> goto out_put_progs;
> }
>
> + if (link->type == BPF_LINK_TYPE_CGROUP) {
Furthermore, I think this link type check can be dropped. Then,
link_update() will keep the same bpf_prog_attach_check_attach_type()
with link_create().
WDYT?
Thanks,
Leon
> + atype = link->attach_type;
> + /*
> + * BPF_LSM_MAC and BPF_LSM_CGROUP share BPF_PROG_TYPE_LSM, so
> + * the helper's default prog-type check cannot distinguish them.
> + */
> + if (new_prog->type == BPF_PROG_TYPE_LSM &&
> + new_prog->expected_attach_type != atype)
> + ret = -EINVAL;
> + else
> + ret = bpf_prog_attach_check_attach_type(new_prog,
> + atype);
> + if (ret)
> + goto out_put_progs;
> + }
> +
> if (link->ops->update_prog)
> ret = link->ops->update_prog(link, new_prog, old_prog);
> else
prev parent reply other threads:[~2026-08-21 13:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 8:47 [PATCH bpf-next v3] bpf: Fix stack out-of-bounds write in cgroup link update Sanghyun Park
2026-08-21 8:57 ` sashiko-bot
2026-08-21 9:41 ` bot+bpf-ci
2026-08-21 10:26 ` Leon Hwang
2026-08-21 19:35 ` Andrii Nakryiko
2026-08-21 13:41 ` Leon Hwang [this message]
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=1ab678ef-6349-4374-9ebf-22f857211ca7@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=pulehui@huawei.com \
--cc=sanghyun.park.cnu@gmail.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
/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