On Wed, 7 Sep 2022 17:02:47 -0700 Joanne Koong <joannelkoong@xxxxxxxxx> wrote: > Add a new helper bpf_dynptr_data_rdonly > > void *bpf_dynptr_data_rdonly(struct bpf_dynptr *ptr, u32 offset, u32 len); > > which gets a read-only pointer to the underlying dynptr data. > > This is equivalent to bpf_dynptr_data(), except the pointer returned is > read-only, which allows this to support both read-write and read-only > dynptrs. > > One example where this will be useful is for skb dynptrs where the > program type only allows read-only access to packet data. This API will > provide a way to obtain a data slice that can be used for direct reads. > > Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx> Reviewed-by: Shmulik Ladkani <shmulik.ladkani@xxxxxxxxx>