From: Jianlin Shi <shijianlin11@foxmail.com>
To: bpf@vger.kernel.org, memxor@gmail.com
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@kernel.org, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, john.fastabend@gmail.com,
kpsingh@chromium.org, sdf@falco.dk, haoluo@google.com,
jolsa@kernel.org, emil@tsalapatis.com, pulehui@huawei.com,
shuah@kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next v4 0/5] bpf: fix stream capacity, read, and oversize handling
Date: Sun, 23 Aug 2026 22:17:23 +0800 [thread overview]
Message-ID: <cover.1787492521.git.shijianlin11@foxmail.com> (raw)
In-Reply-To: <tencent_E69EAE29327E25B3548A9AF3F4FA289A6806@qq.com>
v3 addressed Kartikeya's review on v2 and the related Sashiko findings.
v4 fixes the stream_oversize selftest to verify capacity rollback on the
same BPF program stream, since streams live on prog->aux and are not
shared across programs.
Tested locally:
stream_oversize and stream_partial_read (equivalent to
./test_progs -t stream_oversize,stream_partial_read).
Changelog:
v3 -> v4:
- In stream_oversize, perform the oversized bpf_stream_printk() and a
subsequent successful "foo" push in the same program; read that
program's stream in userspace instead of switching to stream_syscall.
- Drop a redundant vscnprintf() comment in bpf_stream_stage_printk().
v2 -> v3:
- Refactor bpf_stream_release_capacity() to take a length.
- Fix staging-path capacity leak; use vscnprintf().
- Return partial bpf_stream_read() progress on copy_to_user() fault.
- Reject truncated bpf_stream_vprintk() output with -E2BIG.
- Add selftests for oversize and straddling-buffer partial read.
v1 -> v2:
- Retarget to bpf-next as suggested by Pu Lehui.
Links:
v3: https://lore.kernel.org/bpf/?q=%22PATCH+bpf-next+v3+0%2F5%22+fix+stream+capacity
v2: https://lore.kernel.org/bpf/tencent_C919BB32458A4DAD645A68F441345B971E05@qq.com/
v1: https://lore.kernel.org/bpf/tencent_E69EAE29327E25B3548A9AF3F4FA289A6806@qq.com/
Jianlin Shi (5):
bpf: roll back stream capacity when allocation fails
bpf: fix stream capacity leak in staging path
bpf: return partial progress from bpf_stream_read on fault
bpf: reject oversized bpf_stream_vprintk output with -E2BIG
selftests/bpf: cover stream capacity and partial read edge cases
kernel/bpf/stream.c | 53 +++++++++------
.../testing/selftests/bpf/prog_tests/stream.c | 65 +++++++++++++++++++
tools/testing/selftests/bpf/progs/stream.c | 18 +++++
3 files changed, 116 insertions(+), 20 deletions(-)
--
2.43.0
next prev parent reply other threads:[~2026-08-23 14:17 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 1:23 [PATCH bpf] bpf: roll back stream capacity when allocation fails Jianlin Shi
2026-07-20 1:35 ` sashiko-bot
2026-07-20 3:40 ` Pu Lehui
2026-07-20 5:13 ` Jianlin Shi
2026-07-20 5:13 ` [PATCH bpf-next v2] " Jianlin Shi
2026-07-20 5:26 ` sashiko-bot
2026-07-27 3:40 ` Jianlin Shi
2026-07-27 3:58 ` Pu Lehui
2026-08-03 2:40 ` Kumar Kartikeya Dwivedi
2026-08-06 15:49 ` Jianlin Shi
2026-08-15 8:19 ` [PATCH bpf-next v3 0/5] bpf: fix stream capacity, read, and oversize handling Jianlin Shi
[not found] ` <20260815081920.609936-1-shijianlin11@foxmail.com>
2026-08-15 8:19 ` [PATCH bpf-next v3 1/5] bpf: roll back stream capacity when allocation fails Jianlin Shi
2026-08-15 8:32 ` sashiko-bot
2026-08-15 8:19 ` [PATCH bpf-next v3 2/5] bpf: fix stream capacity leak in staging path Jianlin Shi
2026-08-15 8:32 ` sashiko-bot
2026-08-15 9:02 ` bot+bpf-ci
2026-08-23 14:32 ` Jianlin Shi
2026-08-15 8:19 ` [PATCH bpf-next v3 3/5] bpf: return partial progress from bpf_stream_read on fault Jianlin Shi
2026-08-15 8:19 ` [PATCH bpf-next v3 4/5] bpf: reject oversized bpf_stream_vprintk output with -E2BIG Jianlin Shi
2026-08-15 8:19 ` [PATCH bpf-next v3 5/5] selftests/bpf: cover stream capacity and partial read edge cases Jianlin Shi
2026-08-15 8:27 ` sashiko-bot
2026-08-23 14:37 ` Jianlin Shi
2026-08-23 14:17 ` Jianlin Shi [this message]
2026-08-23 14:17 ` [PATCH bpf-next v4 1/5] bpf: roll back stream capacity when allocation fails Jianlin Shi
2026-08-23 19:20 ` patchwork-bot+netdevbpf
2026-08-23 14:17 ` [PATCH bpf-next v4 2/5] bpf: fix stream capacity leak in staging path Jianlin Shi
2026-08-23 14:17 ` [PATCH bpf-next v4 3/5] bpf: return partial progress from bpf_stream_read on fault Jianlin Shi
2026-08-23 14:29 ` sashiko-bot
2026-08-23 14:17 ` [PATCH bpf-next v4 4/5] bpf: reject oversized bpf_stream_vprintk output with -E2BIG Jianlin Shi
2026-08-23 15:10 ` bot+bpf-ci
2026-08-23 14:17 ` [PATCH bpf-next v4 5/5] selftests/bpf: cover stream capacity and partial read edge cases Jianlin Shi
2026-08-23 14:28 ` sashiko-bot
2026-08-23 15:10 ` bot+bpf-ci
2026-08-23 19:22 ` [PATCH bpf-next v4 0/5] bpf: fix stream capacity, read, and oversize handling Kumar Kartikeya Dwivedi
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=cover.1787492521.git.shijianlin11@foxmail.com \
--to=shijianlin11@foxmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@tsalapatis.com \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=pulehui@huawei.com \
--cc=sdf@falco.dk \
--cc=shuah@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.