Re: [PATCH bpf-next v5 01/14] bpf: Add verifier diagnostics report helpers
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <e8ef2022e3d16ceddc37652395938a544fc4f44526ac2018fed7bb43215afa6e@mail.kernel.org> |
> diff --git a/kernel/bpf/diagnostics.c b/kernel/bpf/diagnostics.c
> new file mode 100644
> index 000000000000..e75753552a4d
> --- /dev/null
> +++ b/kernel/bpf/diagnostics.c
> @@ -0,0 +1,47 @@
> +// 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/stdarg.h>
> +
> +#include "diagnostics.h"
> +
> +bool bpf_diag_enabled(const struct bpf_verifier_env *env)
> +{
> + return env->log.level & BPF_LOG_LEVEL;
> +}
> +
> +static void diag_write(struct bpf_verifier_env *env, const char *fmt, ...) __printf(2, 3);
> +
> +static void diag_write(struct bpf_verifier_env *env, const char *fmt, ...)
> +{
This isn't a bug, but could __printf(2, 3) go directly on the
diag_write() definition, as in log.c and verifier.c, so the prototype
does not need to be repeated?
> + va_list args;
> +
> + if (!bpf_diag_enabled(env))
> + return;
> +
> + va_start(args, fmt);
> + bpf_verifier_vlog(&env->log, fmt, args);
> + va_end(args);
> +}
[ ... ]
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/31870608176