diff options
author | Maxim Mikityanskiy <[email protected]> | 2022-06-15 16:48:43 +0300 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2022-06-16 21:20:29 -0700 |
commit | 508362ac66b0478affb4e52cb8da98478312d72d (patch) | |
tree | 8d6674636c26f83165cc4dc4c8838e1d8bfc56c2 /scripts/bpf_doc.py | |
parent | ac80287a6af9fc3f3d189d6d1f523889a0a9e1bc (diff) |
bpf: Allow helpers to accept pointers with a fixed size
Before this commit, the BPF verifier required ARG_PTR_TO_MEM arguments
to be followed by ARG_CONST_SIZE holding the size of the memory region.
The helpers had to check that size in runtime.
There are cases where the size expected by a helper is a compile-time
constant. Checking it in runtime is an unnecessary overhead and waste of
BPF registers.
This commit allows helpers to accept pointers to memory without the
corresponding ARG_CONST_SIZE, given that they define the memory region
size in struct bpf_func_proto and use ARG_PTR_TO_FIXED_SIZE_MEM type.
arg_size is unionized with arg_btf_id to reduce the kernel image size,
and it's valid because they are used by different argument types.
Signed-off-by: Maxim Mikityanskiy <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'scripts/bpf_doc.py')
0 files changed, 0 insertions, 0 deletions