From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
"Mykyta Yatsenko" <mykyta.yatsenko5@gmail.com>
Cc: <bpf@vger.kernel.org>, "Alexei Starovoitov" <ast@kernel.org>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Martin KaFai Lau" <martin.lau@kernel.org>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Ihor Solodrai" <ihor.solodrai@linux.dev>, <kkd@meta.com>,
<kernel-team@meta.com>
Subject: Re: [PATCH bpf-next v3 3/4] libbpf: Request verifier warnings for object loads
Date: Mon, 20 Apr 2026 08:49:53 -0700 [thread overview]
Message-ID: <DHY3NL1SEU8M.3D81XSXXQRRWK@gmail.com> (raw)
In-Reply-To: <CAP01T74ne=kN2+C8Yxqov-2an=mMo8+OSAKXxe9Vqim1qu1WYg@mail.gmail.com>
On Mon Apr 20, 2026 at 8:23 AM PDT, Kumar Kartikeya Dwivedi wrote:
> On Mon, 20 Apr 2026 at 15:57, Mykyta Yatsenko
> <mykyta.yatsenko5@gmail.com> wrote:
>>
>> On 4/18/26 6:16 PM, Kumar Kartikeya Dwivedi wrote:
>> > On kernels supporting BPF_LOG_LEVEL_WARN, have libbpf request verifier
>> > warnings for BPF object program loads by ORing in the warning bit. This
>> > keeps the existing log_level=0 retry semantics for verbose logs, while
>> > still surfacing verifier warnings for successful loads.
>> >
>> > When libbpf owns the log buffer, use a small buffer for warning-only
>> > loads and flush captured warnings through the print callback. Detect
>> > support by probing for BPF_FEAT_VERIFIER_WARNINGS in enum bpf_features,
>> > and document the updated kernel_log_level behavior.
>> >
>> > Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
>> > ---
>> [...]
>> > @@ -7954,7 +7960,10 @@ static int bpf_object_load_prog(struct bpf_object *obj, struct bpf_program *prog
>> >
>> > ret = bpf_prog_load(prog->type, prog_name, license, insns, insns_cnt, &load_attr);
>> > if (ret >= 0) {
>> > - if (log_level && own_log_buf) {
>> > + if (log_level == 16 && load_attr.log_true_size && own_log_buf) {
>> > + pr_warn("prog '%s': -- BEGIN PROG LOAD WARNINGS --\n%s-- END PROG LOAD WARNINGS --\n",
>> > + prog->name, log_buf);
>>
>> I'm not sure if this block makes sense to me: we only print warnings
>> banner is warnings is the only requested log type, but we print no
>> banner if warnings are requested with other log level, also different
>> log_levels: pr_warn() vs pr_debug().
>>
>
> With other log levels, it becomes part of regular verifier output, if
> requested. By default, we want to print them on success at a higher
> log level upon success so they appear, even if the user didn't request
> verbose logs in the log buffer.
> Since the default case only generates warnings, we change the banner,
> but keep it as-is for other scenarios. Does that make sense?
I'm not a fan of banner either.
Screaming BEGIN and END is imo too verbose. I would skip it altogether.
And probably would have removed it from existing 2 places in libbpf.
next prev parent reply other threads:[~2026-04-20 15:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 17:16 [PATCH bpf-next v3 0/4] Add support to emit verifier warnings Kumar Kartikeya Dwivedi
2026-04-18 17:16 ` [PATCH bpf-next v3 1/4] bpf: Add support for verifier warning messages Kumar Kartikeya Dwivedi
2026-04-18 17:42 ` sashiko-bot
2026-04-18 20:33 ` Kumar Kartikeya Dwivedi
2026-04-20 13:37 ` Mykyta Yatsenko
2026-04-20 15:26 ` Kumar Kartikeya Dwivedi
2026-04-18 17:16 ` [PATCH bpf-next v3 2/4] bpf: Introduce __bpf_kfunc_mark_deprecated annotation Kumar Kartikeya Dwivedi
2026-04-18 18:06 ` sashiko-bot
2026-04-18 20:34 ` Kumar Kartikeya Dwivedi
2026-04-20 14:21 ` Mykyta Yatsenko
2026-04-20 15:27 ` Kumar Kartikeya Dwivedi
2026-04-20 18:15 ` David Faust
2026-04-20 18:19 ` Kumar Kartikeya Dwivedi
2026-04-18 17:16 ` [PATCH bpf-next v3 3/4] libbpf: Request verifier warnings for object loads Kumar Kartikeya Dwivedi
2026-04-18 18:35 ` sashiko-bot
2026-04-18 20:38 ` Kumar Kartikeya Dwivedi
2026-04-20 13:57 ` Mykyta Yatsenko
2026-04-20 15:23 ` Kumar Kartikeya Dwivedi
2026-04-20 15:49 ` Alexei Starovoitov [this message]
2026-04-18 17:16 ` [PATCH bpf-next v3 4/4] selftests/bpf: Test verifier warning logging Kumar Kartikeya Dwivedi
2026-04-18 18:45 ` sashiko-bot
2026-04-18 20:39 ` 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=DHY3NL1SEU8M.3D81XSXXQRRWK@gmail.com \
--to=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=mykyta.yatsenko5@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