@@ -330,7 +330,6 @@ struct bpf_arg_type {
ARG_PTR_TO_INT, /* pointer to int */
ARG_PTR_TO_LONG, /* pointer to long */
ARG_PTR_TO_SOCKET, /* pointer to bpf_sock (fullsock) */
- ARG_PTR_TO_SOCKET_OR_NULL, /* pointer to bpf_sock (fullsock) or NULL */
ARG_PTR_TO_BTF_ID, /* pointer to in-kernel struct */
ARG_PTR_TO_ALLOC_MEM, /* pointer to dynamically allocated memory */
ARG_PTR_TO_ALLOC_MEM_OR_NULL, /* pointer to dynamically allocated memory or NULL */
@@ -481,7 +481,6 @@ static bool arg_type_may_be_refcounted(struct bpf_arg_type arg)
static bool arg_type_may_be_null(struct bpf_arg_type arg)
{
return arg.flag & ARG_FLAG_MAYBE_NULL ||
- arg.type == ARG_PTR_TO_SOCKET_OR_NULL ||
arg.type == ARG_PTR_TO_ALLOC_MEM_OR_NULL ||
arg.type == ARG_PTR_TO_STACK_OR_NULL;
}
@@ -5094,7 +5093,6 @@ static const struct bpf_reg_types *compatible_reg_types[__BPF_ARG_TYPE_MAX] = {
[ARG_PTR_TO_BTF_ID_SOCK_COMMON] = &btf_id_sock_common_types,
#endif
[ARG_PTR_TO_SOCKET] = &fullsock_types,
- [ARG_PTR_TO_SOCKET_OR_NULL] = &fullsock_types,
[ARG_PTR_TO_BTF_ID] = &btf_ptr_types,
[ARG_PTR_TO_SPIN_LOCK] = &spin_lock_types,
[ARG_PTR_TO_MEM] = &mem_types,
@@ -10489,7 +10489,10 @@ static const struct bpf_func_proto bpf_sk_lookup_assign_proto = {
.gpl_only = false,
.ret_type = RET_INTEGER,
.arg1 = { .type = ARG_PTR_TO_CTX },
- .arg2 = { .type = ARG_PTR_TO_SOCKET_OR_NULL },
+ .arg2 = {
+ .type = ARG_PTR_TO_SOCKET,
+ .flag = ARG_FLAG_MAYBE_NULL,
+ },
.arg3 = { .type = ARG_ANYTHING },
};
Remove ARG_PTR_TO_SOCKET_OR_NULL and use flag to mark that the argument may be null. Signed-off-by: Hao Luo <haoluo@google.com> --- include/linux/bpf.h | 1 - kernel/bpf/verifier.c | 2 -- net/core/filter.c | 5 ++++- 3 files changed, 4 insertions(+), 4 deletions(-)