From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Eduard Zingerman <eddyz87@gmail.com>,
bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
daniel@iogearbox.net, kafai@meta.com, kernel-team@meta.com,
memxor@gmail.com
Cc: Mykyta Yatsenko <yatsenko@meta.com>
Subject: Re: [RFC PATCH v1 02/10] bpf: widen dynptr size/offset to 64 bit
Date: Fri, 3 Oct 2025 19:53:54 +0100 [thread overview]
Message-ID: <a1b7ad01-f28f-4a60-a15b-3babb1cf26c9@gmail.com> (raw)
In-Reply-To: <10973dbe691484a3a77938db374f9056ce23513a.camel@gmail.com>
On 10/3/25 19:40, Eduard Zingerman wrote:
> On Fri, 2025-10-03 at 17:04 +0100, Mykyta Yatsenko wrote:
>> From: Mykyta Yatsenko <yatsenko@meta.com>
>>
>> Dynptr currently caps size and offset at 24 bits, which isn’t sufficient
>> for file-backed use cases; even 32 bits can be limiting. Refactor dynptr
>> helpers/kfuncs to use 64-bit size and offset, ensuring consistency
>> across the APIs.
>>
>> This change does not affect internals of xdp, skb or other dynptrs,
>> which continue to behave as before.
>>
>> The widening enables large-file access support via dynptr, implemented
>> in the next patches.
> Maybe add a note here that this change does not break binary
> compatibility with BPF programs compiled for older kernels?
>
>> Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
>> ---
> Acked-by: Eduard Zingerman <eddyz87@gmail.com>
>
> [...]
>
>> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
>> index 8f23f5273bab..7cc4f2e05ed2 100644
>> --- a/kernel/trace/bpf_trace.c
>> +++ b/kernel/trace/bpf_trace.c
>> @@ -3372,13 +3372,13 @@ typedef int (*copy_fn_t)(void *dst, const void *src, u32 size, struct task_struc
>> * direct calls into all the specific callback implementations
>> * (copy_user_data_sleepable, copy_user_data_nofault, and so on)
>> */
>> -static __always_inline int __bpf_dynptr_copy_str(struct bpf_dynptr *dptr, u32 doff, u32 size,
>> +static __always_inline int __bpf_dynptr_copy_str(struct bpf_dynptr *dptr, u64 doff, u64 size,
>> const void *unsafe_src,
>> copy_fn_t str_copy_fn,
> The definition for copy_fn_t looks like:
>
> typedef int (*copy_fn_t)(void *dst, const void *src, u32 size, struct task_struct *tsk);
>
> should we change it to use u64 as well? Probably does not matter.
This callback does not work with dynptr, that's why I did not convert it.
>
>> struct task_struct *tsk)
>> {
>> struct bpf_dynptr_kern *dst;
>> - u32 chunk_sz, off;
>> + u64 chunk_sz, off;
>> void *dst_slice;
>> int cnt, err;
>> char buf[256];
> [...]
next prev parent reply other threads:[~2025-10-03 18:53 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-03 16:04 [RFC PATCH v1 00/10] bpf: Introduce file dynptr Mykyta Yatsenko
2025-10-03 16:04 ` [RFC PATCH v1 01/10] selftests/bpf: remove unnecessary kfunc prototypes Mykyta Yatsenko
2025-10-03 17:46 ` Eduard Zingerman
2025-10-03 16:04 ` [RFC PATCH v1 02/10] bpf: widen dynptr size/offset to 64 bit Mykyta Yatsenko
2025-10-03 18:16 ` Andrii Nakryiko
2025-10-03 18:40 ` Eduard Zingerman
2025-10-03 18:53 ` Mykyta Yatsenko [this message]
2025-10-03 16:04 ` [RFC PATCH v1 03/10] lib: extract freader into a separate files Mykyta Yatsenko
2025-10-03 18:16 ` Andrii Nakryiko
2025-10-03 20:04 ` Alexei Starovoitov
2025-10-03 16:04 ` [RFC PATCH v1 04/10] lib/freader: support reading more than 2 folios Mykyta Yatsenko
2025-10-03 18:16 ` Andrii Nakryiko
2025-10-03 18:29 ` Mykyta Yatsenko
2025-10-03 18:46 ` Andrii Nakryiko
2025-10-03 16:04 ` [RFC PATCH v1 05/10] bpf: verifier: centralize const dynptr check in unmark_stack_slots_dynptr() Mykyta Yatsenko
2025-10-03 18:18 ` Andrii Nakryiko
2025-10-03 19:02 ` Eduard Zingerman
2025-10-03 16:04 ` [RFC PATCH v1 06/10] bpf: add plumbing for file-backed dynptr Mykyta Yatsenko
2025-10-03 18:38 ` Andrii Nakryiko
2025-10-03 20:55 ` Eduard Zingerman
2025-10-03 16:04 ` [RFC PATCH v1 07/10] bpf: add kfuncs and helpers support for file dynptrs Mykyta Yatsenko
2025-10-03 18:38 ` Andrii Nakryiko
2025-10-03 18:59 ` Mykyta Yatsenko
2025-10-03 21:35 ` Eduard Zingerman
2025-10-08 0:25 ` Mykyta Yatsenko
2025-10-03 16:04 ` [RFC PATCH v1 08/10] bpf: verifier: refactor kfunc specialization Mykyta Yatsenko
2025-10-03 22:08 ` Eduard Zingerman
2025-10-08 0:35 ` Mykyta Yatsenko
2025-10-08 18:27 ` Mykyta Yatsenko
2025-10-08 19:15 ` Eduard Zingerman
2025-10-03 16:04 ` [RFC PATCH v1 09/10] bpf: dispatch to sleepable file dynptr Mykyta Yatsenko
2025-10-03 18:45 ` Andrii Nakryiko
2025-10-03 20:10 ` Alexei Starovoitov
2025-10-03 22:17 ` Eduard Zingerman
2025-10-03 16:04 ` [RFC PATCH v1 10/10] selftests/bpf: add file dynptr tests Mykyta Yatsenko
2025-10-03 20:02 ` Andrii Nakryiko
2025-10-06 11:50 ` Mykyta Yatsenko
2025-10-06 16:15 ` Andrii Nakryiko
2025-10-03 22:24 ` Eduard Zingerman
2025-10-06 11:54 ` Mykyta Yatsenko
2025-10-08 0:39 ` Mykyta Yatsenko
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=a1b7ad01-f28f-4a60-a15b-3babb1cf26c9@gmail.com \
--to=mykyta.yatsenko5@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kafai@meta.com \
--cc=kernel-team@meta.com \
--cc=memxor@gmail.com \
--cc=yatsenko@meta.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