Re: [PATCH RFC v3 bpf-next 2/4] bpf: Add bpf_copy_from_user() helper.
From: Andrii Nakryiko <hidden>
Date: 2020-06-30 18:23:20
Also in:
bpf
From: Andrii Nakryiko <hidden>
Date: 2020-06-30 18:23:20
Also in:
bpf
On Mon, Jun 29, 2020 at 5:28 PM Alexei Starovoitov [off-list ref] wrote:
On Thu, Jun 18, 2020 at 3:33 PM Andrii Nakryiko [off-list ref] wrote:quoted
quoted
+ * + * int bpf_copy_from_user(void *dst, u32 size, const void *user_ptr)Can we also add bpf_copy_str_from_user (or bpf_copy_from_user_str, whichever makes more sense) as well?Those would have to wait. I think strings need better long term design. That would be separate patches.
I agree that it would be nice to have better support for strings, long term, but that's beside the point. I think bpf_copy_from_user_str() is a must have right now as a sleepable counterpart to bpf_probe_read_user_str(), just like bpf_copy_from_user() is a sleepable variant of bpf_probe_read_user(). Look at progs/strobemeta.h, it does bpf_probe_read_user_str() to get user-space zero-terminated strings. It's well defined interface and behavior. There is nothing extra needed beyond a sleepable variant of bpf_probe_read_user_str() to allow Strobemeta reliably fetch data from user-space from inside a sleepable BPF program.