Re: [PATCH bpf-next v1] bpf: Add flags arg to bpf_dynptr_read and bpf_dynptr_write APIs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 6, 2022 at 4:26 PM Joanne Koong <joannelkoong@xxxxxxxxx> wrote:
>
> Commit 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write")
> added the bpf_dynptr_write and bpf_dynptr_read APIs.
>
> However, it will be useful for some dynptr types to pass in flags as
> well (eg when writing to a skb, the user may like to invalidate the
> hash or recompute the checksum).
>
> This patch adds a "u64 flags" arg to the bpf_dynptr_read and
> bpf_dynptr_write APIs.
>
> Signed-off-by: Joanne Koong <joannelkoong@xxxxxxxxx>
> Fixes: 13bbbfbea759 ("bpf: Add bpf_dynptr_read and bpf_dynptr_write")

Ouch. It's an uapi change in the released kernel :(
It has to go via bpf tree instead of bpf-next.

We have to add support for bpf_dynptr to kfunc and the verifier,
so we can use kfunc-s for all future extensions in dynptr area.

> ---
>  include/uapi/linux/bpf.h                           | 11 +++++++----
>  kernel/bpf/helpers.c                               | 12 ++++++++----
>  tools/include/uapi/linux/bpf.h                     | 11 +++++++----
>  tools/testing/selftests/bpf/progs/dynptr_fail.c    | 10 +++++-----
>  tools/testing/selftests/bpf/progs/dynptr_success.c |  4 ++--
>  5 files changed, 29 insertions(+), 19 deletions(-)
>
> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
> index 379e68fb866f..3dd13fe738b9 100644
> --- a/include/uapi/linux/bpf.h
> +++ b/include/uapi/linux/bpf.h
> @@ -5226,22 +5226,25 @@ union bpf_attr {
>   *     Return
>   *             Nothing. Always succeeds.
>   *
> - * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset)
> + * long bpf_dynptr_read(void *dst, u32 len, struct bpf_dynptr *src, u32 offset, u64 flags)



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux