diff options
| author | Martin KaFai Lau <[email protected]> | 2024-07-22 18:30:45 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2024-07-29 19:54:13 +0000 |
| commit | e42ac14180554fa23a3312d4f921dc4ea7972fb7 (patch) | |
| tree | fe3cb80374b011f76a45a8f43fd15803592ea2bb /tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | |
| parent | bpftool: Add document for net attach/detach on tcx subcommand (diff) | |
| download | kernel-e42ac14180554fa23a3312d4f921dc4ea7972fb7.tar.gz kernel-e42ac14180554fa23a3312d4f921dc4ea7972fb7.zip | |
bpf: Check unsupported ops from the bpf_struct_ops's cfi_stubs
The bpf_tcp_ca struct_ops currently uses a "u32 unsupported_ops[]"
array to track which ops is not supported.
After cfi_stubs had been added, the function pointer in cfi_stubs is
also NULL for the unsupported ops. Thus, the "u32 unsupported_ops[]"
becomes redundant. This observation was originally brought up in the
bpf/cfi discussion:
https://lore.kernel.org/bpf/CAADnVQJoEkdjyCEJRPASjBw1QGsKYrF33QdMGc1RZa9b88bAEA@mail.gmail.com/
The recent bpf qdisc patch (https://lore.kernel.org/bpf/[email protected]/)
also needs to specify quite many unsupported ops. It is a good time
to clean it up.
This patch removes the need of "u32 unsupported_ops[]" and tests for null-ness
in the cfi_stubs instead.
Testing the cfi_stubs is done in a new function bpf_struct_ops_supported().
The verifier will call bpf_struct_ops_supported() when loading the
struct_ops program. The ".check_member" is removed from the bpf_tcp_ca
in this patch. ".check_member" could still be useful for other subsytems
to enforce other restrictions (e.g. sched_ext checks for prog->sleepable).
To keep the same error return, ENOTSUPP is used.
Cc: Amery Hung <[email protected]>
Signed-off-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c')
0 files changed, 0 insertions, 0 deletions
