diff options
| author | Jianlin Shi <shijianlin11@foxmail.com> | 2026-08-23 22:17:27 +0800 |
|---|---|---|
| committer | Kumar Kartikeya Dwivedi <memxor@gmail.com> | 2026-08-23 20:45:21 +0200 |
| commit | 41c0348f6e65c26df4866d5dc96c57b1995fe36c (patch) | |
| tree | 1d1e75649538b8d67073aa4190df6467909f2039 /scripts | |
| parent | 16790357a50baae10de1f619b608a85145d54bc2 (diff) | |
| download | linux-next-41c0348f6e65c26df4866d5dc96c57b1995fe36c.tar.gz linux-next-41c0348f6e65c26df4866d5dc96c57b1995fe36c.zip | |
bpf: Reject oversized bpf_stream_vprintk output with -E2BIG
bstr_printf() returns the would-be length excluding the trailing NUL.
When that value is >= MAX_BPRINTF_BUF the message was truncated, but
bpf_stream_push_str() still tried to allocate with the inflated length
and failed with -ENOMEM. The boundary case of exactly MAX_BPRINTF_BUF
could also copy the trailing NUL into the stream element.
Reject such lengths with -E2BIG before charging stream capacity, and
tighten bpf_stream_elem_alloc() to accept only payloads strictly shorter
than the bprintf buffer.
Fixes: 5ab154f1463a ("bpf: Introduce BPF standard streams")
Signed-off-by: Jianlin Shi <shijianlin11@foxmail.com>
Link: https://lore.kernel.org/r/74387ae5024d7e2996095e97211430285095b525.1787492521.git.shijianlin11@foxmail.com
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'scripts')
0 files changed, 0 insertions, 0 deletions
