From: sashiko-bot@kernel.org
To: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 01/17] bpf: Add verifier diagnostics report helpers
Date: Mon, 13 Jul 2026 15:50:46 +0000 [thread overview]
Message-ID: <20260713155046.E03BA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260713153910.2556007-2-memxor@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The static functions `diag_report_reason` and `diag_report_suggestion` (and their dependent static functions like `diag_report_section`, `diag_vprint_indented`, etc.) are defined but never used in `kernel/bpf/diagnostics.c`. Additionally, several `CATEGORY_*` macros are defined locally in the `.c` file instead of the header, making them inaccessible to external callers.
--
--- Patch [1]: [PATCH bpf-next v3 01/17] bpf: Add verifier diagnostics report helpers ---
commit 1babdf2fc54b5272d1520095320e5a3cddaa9347
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
bpf: Add verifier diagnostics report helpers
Add a small diagnostics renderer for verifier reports and wire it into
the BPF build. The initial helpers emit the common text structure: a
failure header plus reusable report sections.
> diff --git a/kernel/bpf/diagnostics.c b/kernel/bpf/diagnostics.c
> new file mode 100644
> index 0000000000000..6d28a3481cfa5
> --- /dev/null
> +++ b/kernel/bpf/diagnostics.c
> @@ -0,0 +1,157 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +// Copyright (c) 2026 Meta Platforms, Inc. and affiliates.
> +
> +#include <linux/bpf_verifier.h>
> +#include <linux/ctype.h>
> +#include <linux/slab.h>
> +#include <linux/stdarg.h>
> +#include <linux/string.h>
> +
> +#include "diagnostics.h"
> +
> +#define CATEGORY_MEMORY_SAFETY "Memory Safety"
> +#define CATEGORY_REGISTER_TYPE_SAFETY "Register Type Safety"
> +#define CATEGORY_CALL_TYPE_SAFETY "Call Type Safety"
> +#define CATEGORY_RESOURCE_LIFETIME_SAFETY "Resource Lifetime Safety"
> +#define CATEGORY_EXECUTION_CONTEXT_SAFETY "Execution Context Safety"
> +#define CATEGORY_PROGRAM_STRUCTURE "Program Structure"
> +#define CATEGORY_POLICY "Policy"
> +#define CATEGORY_VERIFIER_LIMIT "Verifier Limit"
> +#define CATEGORY_VERIFIER_INTERNAL_ERROR "Verifier Internal Error"
[Severity: Low]
Should these CATEGORY_* macros be exported in the diagnostics.h header? Since
they define the expected categories for bpf_diag_report_header(), keeping
them local to this .c file prevents other subsystems from accessing them
when calling the API.
[ ... ]
> +static void diag_report_reason(struct bpf_verifier_env *env, const char *fmt, ...)
> +{
> + va_list args;
> +
> + if (!bpf_diag_enabled(env))
> + return;
> +
> + diag_report_section(env, "Reason");
> +
> + va_start(args, fmt);
> + diag_vprint_indented(env, fmt, args);
> + va_end(args);
> +}
> +
> +static void diag_report_suggestion(struct bpf_verifier_env *env, const char *fmt, ...)
> +{
> + va_list args;
> +
> + if (!bpf_diag_enabled(env))
> + return;
> +
> + diag_report_section(env, "Suggestion");
> +
> + va_start(args, fmt);
> + diag_vprint_indented(env, fmt, args);
> + va_end(args);
> + diag_log(env, "\n");
> +}
[Severity: Low]
Will these static functions trigger -Wunused-function compiler warnings?
Since diag_report_reason() and diag_report_suggestion() are defined but
never called or exported in this patch, they could break the build when
CONFIG_WERROR=y is enabled.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260713153910.2556007-1-memxor@gmail.com?part=1
next prev parent reply other threads:[~2026-07-13 15:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 15:38 [PATCH bpf-next v3 00/17] Redesign Verification Errors Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 01/17] bpf: Add verifier diagnostics report helpers Kumar Kartikeya Dwivedi
2026-07-13 15:50 ` sashiko-bot [this message]
2026-07-13 15:38 ` [PATCH bpf-next v3 02/17] bpf: Add source and instruction diagnostic context Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 03/17] bpf: Add verifier diagnostic event log Kumar Kartikeya Dwivedi
2026-07-13 15:54 ` sashiko-bot
2026-07-13 15:38 ` [PATCH bpf-next v3 04/17] bpf: Prune verifier diagnostics when switching paths Kumar Kartikeya Dwivedi
2026-07-13 16:02 ` sashiko-bot
2026-07-13 15:38 ` [PATCH bpf-next v3 05/17] bpf: Track verifier register diagnostic events Kumar Kartikeya Dwivedi
2026-07-13 16:06 ` sashiko-bot
2026-07-13 15:38 ` [PATCH bpf-next v3 06/17] bpf: Track verifier reference " Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 07/17] bpf: Track verifier context " Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 08/17] bpf: Report Register Type Safety errors Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 09/17] bpf: Report Memory Safety bounds errors Kumar Kartikeya Dwivedi
2026-07-13 15:38 ` [PATCH bpf-next v3 10/17] bpf: Report Resource Lifetime reference leaks Kumar Kartikeya Dwivedi
2026-07-13 16:04 ` sashiko-bot
2026-07-13 15:39 ` [PATCH bpf-next v3 11/17] bpf: Report Call Type Safety argument errors Kumar Kartikeya Dwivedi
2026-07-13 15:51 ` sashiko-bot
2026-07-13 15:39 ` [PATCH bpf-next v3 12/17] bpf: Report Execution Context Safety errors Kumar Kartikeya Dwivedi
2026-07-13 15:53 ` sashiko-bot
2026-07-13 15:39 ` [PATCH bpf-next v3 13/17] bpf: Report Program Structure CFG errors Kumar Kartikeya Dwivedi
2026-07-14 20:00 ` Eduard Zingerman
2026-07-13 15:39 ` [PATCH bpf-next v3 14/17] bpf: Report Policy helper and kfunc errors Kumar Kartikeya Dwivedi
2026-07-13 16:09 ` sashiko-bot
2026-07-13 15:39 ` [PATCH bpf-next v3 15/17] bpf: Report Verifier Limit errors Kumar Kartikeya Dwivedi
2026-07-13 15:39 ` [PATCH bpf-next v3 16/17] bpf: Report Verifier Internal errors Kumar Kartikeya Dwivedi
2026-07-14 23:17 ` Eduard Zingerman
2026-07-13 15:39 ` [PATCH bpf-next v3 17/17] bpf: Gate verifier diagnostics on log level Kumar Kartikeya Dwivedi
2026-07-14 3:36 ` kernel test robot
2026-07-14 6:10 ` [syzbot ci] Re: Redesign Verification Errors syzbot ci
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=20260713155046.E03BA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=memxor@gmail.com \
--cc=sashiko-reviews@lists.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