bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Eduard Zingerman <eddyz87@gmail.com>,
	Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
	andrii@kernel.org
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net,
	mykolal@fb.com, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc
Date: Thu, 19 Jun 2025 11:04:57 -0700	[thread overview]
Message-ID: <c8540b80-2903-4e31-a4ee-93278475d232@linux.dev> (raw)
In-Reply-To: <50c2f252620107b6fa6642e281a91db444b032c5.camel@gmail.com>

On 6/19/25 10:57 AM, Eduard Zingerman wrote:
> On Thu, 2025-06-19 at 10:55 -0700, Ihor Solodrai wrote:
> 
> [...]
> 
>>> I think Mykyta has kernel/trace/bpf_trace.c:__bpf_dynptr_copy_str() in mind.
>>
>> Thanks for the pointer. So it looks like memset can use
>> bpf_dynptr_slice_rdwr() to handle xdp/skb cases. Something like:
>>
>>       void *ptr = bpf_dynptr_slice_rdwr(&dynptr, 0, buffer, sizeof(buffer));
>>       if (!ptr)
>>           return -EINVAL;
>>
>>       memset(ptr, val, n);
>>
>>       if (ptr == buffer)
>>           bpf_dynptr_write(&dynptr, 0, buffer, sizeof(buffer), 0);
>>
>>
> 
> I think so. In a loop.

But allocating and copying buffers for memset...

It should be possible to walk through fragments like
net/core/filter.c:bpf_xdp_copy_buf does.

Any reasons it's a bad idea?

> 


  reply	other threads:[~2025-06-19 18:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 22:33 [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc Ihor Solodrai
2025-06-18 22:33 ` [PATCH bpf-next 2/2] selftests/bpf: add test cases for bpf_dynptr_memset() Ihor Solodrai
2025-06-18 23:44 ` [PATCH bpf-next 1/2] bpf: add bpf_dynptr_memset() kfunc Mykyta Yatsenko
2025-06-19 17:09   ` Ihor Solodrai
2025-06-19 17:19     ` Eduard Zingerman
2025-06-19 17:55       ` Ihor Solodrai
2025-06-19 17:57         ` Eduard Zingerman
2025-06-19 18:04           ` Ihor Solodrai [this message]
2025-06-19 18:13             ` Eduard Zingerman
2025-06-19 18:17               ` Eduard Zingerman
2025-06-23 21:38                 ` Andrii Nakryiko
2025-06-23 21:45                   ` Eduard Zingerman
2025-06-23 22:12                     ` Andrii Nakryiko
2025-06-20 15:09       ` 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=c8540b80-2903-4e31-a4ee-93278475d232@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=mykolal@fb.com \
    --cc=mykyta.yatsenko5@gmail.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;
as well as URLs for NNTP newsgroup(s).