Thread (19 messages) 19 messages, 3 authors, 2026-03-04

Re: [PATCH bpf-next v10 3/8] bpf: Refactor reporting log_true_size for prog_load

From: Alexei Starovoitov <hidden>
Date: 2026-03-04 05:58:34
Also in: bpf, linux-kselftest, lkml

On Tue, Mar 3, 2026 at 9:47 PM Leon Hwang [off-list ref] wrote:
On 4/3/26 00:32, Alexei Starovoitov wrote:
quoted
On Wed, Feb 11, 2026 at 7:13 AM Leon Hwang [off-list ref] wrote:
quoted
[...]
quoted
quoted
@@ -6241,7 +6244,11 @@ static int __sys_bpf(enum bpf_cmd cmd, bpfptr_t uattr, unsigned int size,
                err = map_freeze(&attr);
                break;
        case BPF_PROG_LOAD:
-               err = bpf_prog_load(&attr, uattr, size);
+               if (from_user && size >= offsetofend(union bpf_attr, log_true_size))
+                       log_true_size = uattr.user + offsetof(union bpf_attr, log_true_size);
So you added 'from_user' gating because
you replaced copy_to_bpfptr_offset() with copy_to_user()?
This is a drastic change in behavior and you don't even talk about
it in the commit log.
You said "refactor". This is not a refactoring!

This is v10. The common_attr feature is useful, but
you really need to think harder about what your patches
are doing.
Refactoring should not introduce any functional changes. If a functional
change is involved, it should be factored out of the refactoring commit
into a separate commit with an explanation in the commit log.

I'll add this to my self-review checklist.

The intention of 'from_user' was to replace copy_to_bpfptr_offset() with
copy_to_user(), since the log is always copied to the user-space buffer
when the log level is not BPF_LOG_KERNEL in
kernel/bpf/log.c::bpf_verifier_vlog().

The 'from_user' gating will be dropped in v12 to keep this patch as pure
refactoring.
You were told multiple times to avoid copy pasting AI into your emails.
Sorry, but this crosses the line for me.
Your patches will be ignored for 2 weeks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help