Re: [RFC PATCH bpf-next 4/9] bpf: Remove ARG_CONST_SIZE_OR_ZERO

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

 



On Mon, Nov 8, 2021 at 6:16 PM Hao Luo <haoluo@xxxxxxxxxx> wrote:
>
> Remove ARG_CONST_SIZE_OR_ZERO and use flag to mark that the
> argument may be zero.
>
> Signed-off-by: Hao Luo <haoluo@xxxxxxxxxx>
> ---
>  include/linux/bpf.h      |  2 -
>  kernel/bpf/helpers.c     | 20 +++++++--
>  kernel/bpf/ringbuf.c     |  5 ++-
>  kernel/bpf/stackmap.c    | 15 +++++--
>  kernel/bpf/verifier.c    |  8 ++--
>  kernel/trace/bpf_trace.c | 90 ++++++++++++++++++++++++++++++++--------
>  net/core/filter.c        | 35 ++++++++++++----
>  7 files changed, 135 insertions(+), 40 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index dd92418814b5..27f81989f992 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -323,8 +323,6 @@ struct bpf_arg_type {
>                                          */
>
>                 ARG_CONST_SIZE,         /* number of bytes accessed from memory */
> -               ARG_CONST_SIZE_OR_ZERO, /* number of bytes accessed from memory or 0 */
> -
>                 ARG_PTR_TO_CTX,         /* pointer to context */
>                 ARG_PTR_TO_CTX_OR_NULL, /* pointer to context or NULL */
>                 ARG_ANYTHING,           /* any (initialized) argument is ok */
> diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
> index cd792777afb2..082a8620f666 100644
> --- a/kernel/bpf/helpers.c
> +++ b/kernel/bpf/helpers.c
> @@ -631,7 +631,10 @@ const struct bpf_func_proto bpf_event_output_data_proto =  {
>         .arg2           = { .type = ARG_CONST_MAP_PTR },
>         .arg3           = { .type = ARG_ANYTHING },
>         .arg4           = { .type = ARG_PTR_TO_MEM },
> -       .arg5           = { .type = ARG_CONST_SIZE_OR_ZERO },
> +       .arg5           = {
> +               .type = ARG_CONST_SIZE,
> +               .flag = ARG_FLAG_MAYBE_NULL,

wait, OR_NULL and OR_ZERO isn't exactly the same thing... why are we
conflating them?

> +       },
>  };
>
>  BPF_CALL_3(bpf_copy_from_user, void *, dst, u32, size,

[...]



[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