On Sat, Apr 8, 2023 at 8:34 PM Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > > bpf_dynptr_get_size returns the number of useable bytes in a dynptr and > bpf_dynptr_get_offset returns the current offset into the dynptr. > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> > --- > include/linux/bpf.h | 2 +- > kernel/bpf/helpers.c | 24 +++++++++++++++++++++--- > kernel/trace/bpf_trace.c | 4 ++-- > 3 files changed, 24 insertions(+), 6 deletions(-) > [...] > +__bpf_kfunc __u32 bpf_dynptr_get_size(const struct bpf_dynptr_kern *ptr) > +{ > + if (!ptr->data) > + return -EINVAL; > + > + return __bpf_dynptr_get_size(ptr); > +} > + > +__bpf_kfunc __u32 bpf_dynptr_get_offset(const struct bpf_dynptr_kern *ptr) I think get_offset is actually not essential and it's hard to think about the case where this is going to be really necessary. Let's keep only get_size for now? > +{ > + if (!ptr->data) > + return -EINVAL; > + > + return ptr->offset; > +} > + [...]