Re: [PATCH v2] bpf: allow BPF_LOG_KERNEL from kernel space

From: bot+bpf-ci

Date: Wed Jun 24 2026 - 15:27:50 EST


> diff --git a/kernel/bpf/log.c b/kernel/bpf/log.c
> index b740fa73ee26..25a9f8340980 100644
> --- a/kernel/bpf/log.c
> +++ b/kernel/bpf/log.c
> @@ -21,6 +21,15 @@ static bool bpf_verifier_log_attr_valid(u32 log_level, char __user *log_buf, u32
> /* log buf without log_level is meaningless */
> if (log_buf && log_level == 0)
> return false;
> +
> + /* BPF_LOG_KERNEL is an exclusive internal mode, not a bit flag.
> + * It must be checked via strict equality to prevent it from being
> + * combined with userspace flags, which would cause the verifier
> + * to fallback to userspace logging and copy_to_user() failures.
> + */

This isn't a bug, but would it read more in line with the BPF multi-line
comment style to put the opening /* on its own line here? The text
currently starts on the same line as the opening /*:

/* BPF_LOG_KERNEL is an exclusive internal mode, not a bit flag.
* It must be checked via strict equality ...

> + if (log_level == BPF_LOG_KERNEL)
> + return true;
> +
> if (log_level & ~BPF_LOG_MASK)
> return false;
> if (log_size > UINT_MAX >> 2)


---
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/28121265957