diff options
Diffstat (limited to 'kernel/bpf/helpers.c')
| -rw-r--r-- | kernel/bpf/helpers.c | 24 | 
1 files changed, 14 insertions, 10 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 225806a02efb..1f961f9982d2 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -584,7 +584,7 @@ BPF_CALL_3(bpf_strncmp, const char *, s1, u32, s1_sz, const char *, s2)  	return strncmp(s1, s2, s1_sz);  } -const struct bpf_func_proto bpf_strncmp_proto = { +static const struct bpf_func_proto bpf_strncmp_proto = {  	.func		= bpf_strncmp,  	.gpl_only	= false,  	.ret_type	= RET_INTEGER, @@ -1402,7 +1402,7 @@ BPF_CALL_2(bpf_kptr_xchg, void *, map_value, void *, ptr)   */  #define BPF_PTR_POISON ((void *)((0xeB9FUL << 2) + POISON_POINTER_DELTA)) -const struct bpf_func_proto bpf_kptr_xchg_proto = { +static const struct bpf_func_proto bpf_kptr_xchg_proto = {  	.func         = bpf_kptr_xchg,  	.gpl_only     = false,  	.ret_type     = RET_PTR_TO_BTF_ID_OR_NULL, @@ -1487,7 +1487,7 @@ error:  	return err;  } -const struct bpf_func_proto bpf_dynptr_from_mem_proto = { +static const struct bpf_func_proto bpf_dynptr_from_mem_proto = {  	.func		= bpf_dynptr_from_mem,  	.gpl_only	= false,  	.ret_type	= RET_INTEGER, @@ -1497,11 +1497,12 @@ const struct bpf_func_proto bpf_dynptr_from_mem_proto = {  	.arg4_type	= ARG_PTR_TO_DYNPTR | DYNPTR_TYPE_LOCAL | MEM_UNINIT,  }; -BPF_CALL_4(bpf_dynptr_read, void *, dst, u32, len, struct bpf_dynptr_kern *, src, u32, offset) +BPF_CALL_5(bpf_dynptr_read, void *, dst, u32, len, struct bpf_dynptr_kern *, src, +	   u32, offset, u64, flags)  {  	int err; -	if (!src->data) +	if (!src->data || flags)  		return -EINVAL;  	err = bpf_dynptr_check_off_len(src, offset, len); @@ -1513,7 +1514,7 @@ BPF_CALL_4(bpf_dynptr_read, void *, dst, u32, len, struct bpf_dynptr_kern *, src  	return 0;  } -const struct bpf_func_proto bpf_dynptr_read_proto = { +static const struct bpf_func_proto bpf_dynptr_read_proto = {  	.func		= bpf_dynptr_read,  	.gpl_only	= false,  	.ret_type	= RET_INTEGER, @@ -1521,13 +1522,15 @@ const struct bpf_func_proto bpf_dynptr_read_proto = {  	.arg2_type	= ARG_CONST_SIZE_OR_ZERO,  	.arg3_type	= ARG_PTR_TO_DYNPTR,  	.arg4_type	= ARG_ANYTHING, +	.arg5_type	= ARG_ANYTHING,  }; -BPF_CALL_4(bpf_dynptr_write, struct bpf_dynptr_kern *, dst, u32, offset, void *, src, u32, len) +BPF_CALL_5(bpf_dynptr_write, struct bpf_dynptr_kern *, dst, u32, offset, void *, src, +	   u32, len, u64, flags)  {  	int err; -	if (!dst->data || bpf_dynptr_is_rdonly(dst)) +	if (!dst->data || flags || bpf_dynptr_is_rdonly(dst))  		return -EINVAL;  	err = bpf_dynptr_check_off_len(dst, offset, len); @@ -1539,7 +1542,7 @@ BPF_CALL_4(bpf_dynptr_write, struct bpf_dynptr_kern *, dst, u32, offset, void *,  	return 0;  } -const struct bpf_func_proto bpf_dynptr_write_proto = { +static const struct bpf_func_proto bpf_dynptr_write_proto = {  	.func		= bpf_dynptr_write,  	.gpl_only	= false,  	.ret_type	= RET_INTEGER, @@ -1547,6 +1550,7 @@ const struct bpf_func_proto bpf_dynptr_write_proto = {  	.arg2_type	= ARG_ANYTHING,  	.arg3_type	= ARG_PTR_TO_MEM | MEM_RDONLY,  	.arg4_type	= ARG_CONST_SIZE_OR_ZERO, +	.arg5_type	= ARG_ANYTHING,  };  BPF_CALL_3(bpf_dynptr_data, struct bpf_dynptr_kern *, ptr, u32, offset, u32, len) @@ -1566,7 +1570,7 @@ BPF_CALL_3(bpf_dynptr_data, struct bpf_dynptr_kern *, ptr, u32, offset, u32, len  	return (unsigned long)(ptr->data + ptr->offset + offset);  } -const struct bpf_func_proto bpf_dynptr_data_proto = { +static const struct bpf_func_proto bpf_dynptr_data_proto = {  	.func		= bpf_dynptr_data,  	.gpl_only	= false,  	.ret_type	= RET_PTR_TO_DYNPTR_MEM_OR_NULL,  |