From: Daniel Borkmann <daniel@iogearbox.net>
To: 임준서 <zirajs7@gmail.com>, "Emil Tsalapatis" <emil@etsalapatis.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Stanislav Fomichev <sdf@fomichev.me>, Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
Sechang Lim <rhkrqnwk98@gmail.com>
Subject: Re: [PATCH bpf] bpf: Reject negative optlen in cgroup getsockopt hook
Date: Wed, 5 Aug 2026 21:01:46 +0200 [thread overview]
Message-ID: <c1104f11-2444-405e-9fcf-08c2a7bb94cb@iogearbox.net> (raw)
In-Reply-To: <CAB4FuGYv8eUAWzJZB7HbOTktYq-RKB35roAqsT52WxHh_P3VJg@mail.gmail.com>
On 8/1/26 10:26 AM, 임준서 wrote:
> Thanks for the review.
>
> The reproducer already sets ctx->optlen to a negative value (-11) in
> the cgroup BPF program:
>
> /* ctx->optlen = -11; */
> BPF_MOV64_IMM(BPF_REG_2, -11),
> BPF_STX_MEM(BPF_W, BPF_REG_1, BPF_REG_2,
> offsetof(struct bpf_sockopt, optlen)),
>
> https://gist.github.com/ZirAjs/a177ec6d8f2c8ed7d93edca6313a9255
>
> The PASS/FAIL output only checks the behavior before and after applying the
> patch. Without the patch, the negative value reaches copy_to_sockptr() and
> triggers the warning. With the patch, getsockopt() rejects it with -EFAULT.
>
> Would you prefer that I include the reproducer directly in the patch
> submission rather than only linking to the gist?
Yes, please add it as 2nd commit and check git log on how to integrate it
into test_progs (tools/testing/selftests/bpf/) so it can run via CI.
Thanks,
Daniel
prev parent reply other threads:[~2026-08-05 19:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-26 7:01 Junseo Lim
2026-07-29 21:36 ` Emil Tsalapatis
2026-08-01 8:26 ` 임준서
2026-08-05 19:01 ` Daniel Borkmann [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=c1104f11-2444-405e-9fcf-08c2a7bb94cb@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=rhkrqnwk98@gmail.com \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=yonghong.song@linux.dev \
--cc=zirajs7@gmail.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
all inboxes | Powered by JetHome®