From: Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin Lau <kafai@meta.com>, Kernel Team <kernel-team@meta.com>,
Eduard <eddyz87@gmail.com>, Mykyta Yatsenko <yatsenko@meta.com>
Subject: Re: [PATCH bpf-next v4 2/3] bpf: implement dynptr copy kfuncs
Date: Fri, 9 May 2025 16:56:25 +0100 [thread overview]
Message-ID: <fafb2a02-effb-4099-ae9d-eba68375ca40@gmail.com> (raw)
In-Reply-To: <CAADnVQK3oXfVtKR-SM07N3+-AtoU+Khcvu_HLv6QXkO6hthgvg@mail.gmail.com>
On 5/9/25 16:50, Alexei Starovoitov wrote:
> On Thu, May 8, 2025 at 3:06 PM Mykyta Yatsenko
> <mykyta.yatsenko5@gmail.com> wrote:
>> +static __always_inline int __bpf_dynptr_copy_str(struct bpf_dynptr *dptr, u32 doff, u32 size,
>> + const void __user *unsafe_src,
>> + copy_fn_t str_copy_fn,
>> + struct task_struct *tsk)
>> +{
> ...
>> +__bpf_kfunc int bpf_copy_from_user_task_str_dynptr(struct bpf_dynptr *dptr, u32 off,
>> + u32 size, const void *unsafe_ptr__ign,
>> + struct task_struct *tsk)
>> +{
>> + return __bpf_dynptr_copy_str(dptr, off, size, unsafe_ptr__ign,
>> + copy_user_str_sleepable, tsk);
>> +}
> CI is not happy about implicit cast that changes address spaces:
>
> ../kernel/trace/bpf_trace.c:3702:55: warning: incorrect type in
> argument 4 (different address spaces)
> ../kernel/trace/bpf_trace.c:3702:55: expected void const [noderef]
> __user *unsafe_src
> ../kernel/trace/bpf_trace.c:3702:55: got void const *unsafe_ptr__ign
>
> Please use gcc 14 or higher or sparse to see them.
>
> Probably __bpf_dynptr_copy_str() shouldn't have __user qualifier,
> but bpf_copy_from_user_task_str_dynptr() should have __user next to
> unsafe_ptr__ign,
> and everywhere we kfunc has __user it can case to (const void *) before
> calling __bpf_dynptr_copy_str().
I'll check it, thanks.
next prev parent reply other threads:[~2025-05-09 15:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 22:06 [PATCH bpf-next v4 0/3] Introduce kfuncs for memory reads into dynptrs Mykyta Yatsenko
2025-05-08 22:06 ` [PATCH bpf-next v4 1/3] helpers: make few bpf helpers public Mykyta Yatsenko
2025-05-08 22:06 ` [PATCH bpf-next v4 2/3] bpf: implement dynptr copy kfuncs Mykyta Yatsenko
2025-05-09 15:50 ` Alexei Starovoitov
2025-05-09 15:56 ` Mykyta Yatsenko [this message]
2025-05-08 22:06 ` [PATCH bpf-next v4 3/3] selftests/bpf: introduce tests for " 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=fafb2a02-effb-4099-ae9d-eba68375ca40@gmail.com \
--to=mykyta.yatsenko5@gmail.com \
--cc=alexei.starovoitov@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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.