lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <639fe690-2a47-45fb-843e-31e91f6d2dd0@gmail.com>
Date: Mon, 16 Jun 2025 21:34:26 +0100
From: Pavel Begunkov <asml.silence@...il.com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Andrii Nakryiko <andrii@...nel.org>, io-uring@...r.kernel.org,
 Martin KaFai Lau <martin.lau@...ux.dev>, bpf <bpf@...r.kernel.org>,
 LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC v2 5/5] io_uring/bpf: add basic kfunc helpers

On 6/13/25 20:51, Alexei Starovoitov wrote:
> On Fri, Jun 13, 2025 at 9:11 AM Pavel Begunkov <asml.silence@...il.com> wrote:
...>>
>> It's valid within a single run of the callback but shouldn't cross
>> into another invocation. Specifically, it's protected by the lock,
>> but that can be tuned. Does that match with what PTR_TO_MEM expects?
> 
> yes. PTR_TO_MEM lasts for duration of the prog.
> 
>> I can add refcounting for longer term pinning, maybe to store it
>> as a bpf map or whatever is the right way, but I'd rather avoid
>> anything expensive in the kfunc as that'll likely be called on
>> every program run.
> 
> yeah. let's not add any refcounting.
> 
> It sounds like you want something similar to
> __bpf_kfunc __u8 *
> hid_bpf_get_data(struct hid_bpf_ctx *ctx, unsigned int offset, const
> size_t rdwr_buf_size)
> 
> we have a special hack for it already in the verifier.
> The argument need to be called rdwr_buf_size,
> then it will be used to establish the range of PTR_TO_MEM.
> It has to be run-time constant.

Great, I can just use that

> What you're proposing with "__retsz" is a cleaner version of the same.
> But consider bpf_dynptr_from_io_uring(struct io_ring_ctx *ctx)
> it can create a dynamically sized region,
> and later use bpf_dynptr_slice_rdwr() to get writeable chunk of it.
> 
> I feel that __retsz approach may actually be a better fit at the end,
> if you're ok with constant arg.
I took a quick look, 16MB sounds a bit restrictive long term. I'll
just go for rdwr_buf_size while experimenting and hopefully will be
able to make a more educated choice later

-- 
Pavel Begunkov


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ