• Hao Luo's avatar
    bpf: Replace ARG_XXX_OR_NULL with ARG_XXX | PTR_MAYBE_NULL · 48946bd6
    Hao Luo authored
    We have introduced a new type to make bpf_arg composable, by
    reserving high bits of bpf_arg to represent flags of a type.
    
    One of the flags is PTR_MAYBE_NULL which indicates a pointer
    may be NULL. When applying this flag to an arg_type, it means
    the arg can take NULL pointer. This patch switches the
    qualified arg_types to use this flag. The arg_types changed
    in this patch include:
    
    1. ARG_PTR_TO_MAP_VALUE_OR_NULL
    2. ARG_PTR_TO_MEM_OR_NULL
    3. ARG_PTR_TO_CTX_OR_NULL
    4. ARG_PTR_TO_SOCKET_OR_NULL
    5. ARG_PTR_TO_ALLOC_MEM_OR_NULL
    6. ARG_PTR_TO_STACK_OR_NULL
    
    This patch does not eliminate the use of these arg_types, instead
    it makes them an alias to the 'ARG_XXX | PTR_MAYBE_NULL'.
    Signed-off-by: default avatarHao Luo <haoluo@google.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20211217003152.48334-3-haoluo@google.com
    48946bd6
verifier.c 409 KB