From: Leon Hwang <leon.hwang@linux.dev>
To: bot+bpf-ci@kernel.org
Cc: Leon Hwang <leon.hwang@linux.dev>,
bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
john.fastabend@gmail.com, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
yonghong.song@linux.dev, kpsingh@kernel.org, sdf@fomichev.me,
haoluo@google.com, jolsa@kernel.org, shuah@kernel.org,
brauner@kernel.org, sforshee@kernel.org, yuichtsu@amazon.com,
aalbersh@redhat.com, willemb@google.com,
kerneljasonxing@gmail.com, chen.dylane@linux.dev,
yatsenko@meta.com, memxor@gmail.com, a.s.protopopov@gmail.com,
ameryhung@gmail.com, rongtao@cestc.cn,
linux-kernel@vger.kernel.org, linux-api@vger.kernel.org,
linux-kselftest@vger.kernel.org, kernel-patches-bot@fb.com,
martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v12 5/8] bpf: Add syscall common attributes support for btf_load
Date: Wed, 22 Apr 2026 13:28:49 +0800 [thread overview]
Message-ID: <20260422052900.355836-1-leon.hwang@linux.dev> (raw)
In-Reply-To: <a007ad07d6c91fc692fe29e0a57f1f6059f27eb4d147cb987d01f955b76d3c36@mail.kernel.org>
On Mon, 20 Apr 2026 14:56:31 +0000 (UTC), bot+bpf-ci@kernel.org wrote:
>> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
>> index 1eb15a51c7dc..06aea4e499a1 100644
>> --- a/kernel/bpf/syscall.c
>> +++ b/kernel/bpf/syscall.c
>
> [ ... ]
>
>> @@ -6317,7 +6317,12 @@ static int __sys_bpf(enum bpf_cmd cmd, bpfptr_t uattr, unsigned int size,
>> err = bpf_raw_tracepoint_open(&attr);
>> break;
>> case BPF_BTF_LOAD:
>> - err = bpf_btf_load(&attr, uattr, size);
>> + if (size >= offsetofend(union bpf_attr, btf_log_true_size))
>> + offsetof_log_true_size = offsetof(union bpf_attr, btf_log_true_size);
>> + err = bpf_log_attr_init(&attr_log, attr.btf_log_buf, attr.btf_log_size,
>> + attr.btf_log_level, offsetof_log_true_size, uattr,
>> + &attr_common, uattr_common, size_common);
>> + err = err ?: bpf_btf_load(&attr, uattr, &attr_log);
>
> Should the log_true_size offset be set only for user space calls? In v10
> review, Andrii Nakryiko noted that log_true_size should only be set for
> user space, not kernel space calls.
>
> https://lore.kernel.org/bpf/CAEf4BzY3GA+860RODLaXqqO3j5AgJ24pmKU1yv3+gHJpy0DvNA@mail.gmail.com/
>
> The current code does not check uattr.is_kernel before setting
> offsetof_log_true_size. This could cause issues when bpf_sys_bpf() calls
> __sys_bpf() with KERNEL_BPFPTR, as it would attempt to write log_true_size
> to a kernel pointer instead of a user space pointer.
>
Not true. 'uattr.is_kernel' will be checked in copy_to_bpfptr_offset().
When write log_true_size to a kernel pointer, memcpy() will be used.
Thanks,
Leon
>> break;
>> case BPF_BTF_GET_FD_BY_ID:
>> err = bpf_btf_get_fd_by_id(&attr);
>
>
> ---
> 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/24672239158
next prev parent reply other threads:[~2026-04-22 5:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-20 14:17 [PATCH bpf-next v12 0/8] bpf: Extend BPF syscall with common attributes support Leon Hwang
2026-04-20 14:17 ` [PATCH bpf-next v12 1/8] " Leon Hwang
2026-04-20 14:17 ` [PATCH bpf-next v12 2/8] libbpf: Add support for extended BPF syscall Leon Hwang
2026-04-20 14:17 ` [PATCH bpf-next v12 3/8] bpf: Refactor reporting log_true_size for prog_load Leon Hwang
2026-04-20 14:18 ` [PATCH bpf-next v12 4/8] bpf: Add syscall common attributes support " Leon Hwang
2026-04-20 14:18 ` [PATCH bpf-next v12 5/8] bpf: Add syscall common attributes support for btf_load Leon Hwang
2026-04-20 14:56 ` bot+bpf-ci
2026-04-22 5:28 ` Leon Hwang [this message]
2026-04-20 14:18 ` [PATCH bpf-next v12 6/8] bpf: Add syscall common attributes support for map_create Leon Hwang
2026-04-20 14:56 ` bot+bpf-ci
2026-04-22 5:44 ` Leon Hwang
2026-04-20 14:18 ` [PATCH bpf-next v12 7/8] libbpf: " Leon Hwang
2026-04-20 14:18 ` [PATCH bpf-next v12 8/8] selftests/bpf: Add tests to verify map create failure log Leon Hwang
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=20260422052900.355836-1-leon.hwang@linux.dev \
--to=leon.hwang@linux.dev \
--cc=a.s.protopopov@gmail.com \
--cc=aalbersh@redhat.com \
--cc=ameryhung@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=chen.dylane@linux.dev \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=haoluo@google.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-patches-bot@fb.com \
--cc=kerneljasonxing@gmail.com \
--cc=kpsingh@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=rongtao@cestc.cn \
--cc=sdf@fomichev.me \
--cc=sforshee@kernel.org \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=willemb@google.com \
--cc=yatsenko@meta.com \
--cc=yonghong.song@linux.dev \
--cc=yuichtsu@amazon.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