diff options
| author | Eduard Zingerman <[email protected]> | 2024-03-06 10:45:16 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2024-03-06 23:18:15 +0000 |
| commit | d9ab2f76ef5abb76190ffb42d83bdc6caede807e (patch) | |
| tree | ea29a8f148822b4c4874a56cd456bd2435f81980 /tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | |
| parent | libbpf: Allow version suffixes (___smth) for struct_ops types (diff) | |
| download | kernel-d9ab2f76ef5abb76190ffb42d83bdc6caede807e.tar.gz kernel-d9ab2f76ef5abb76190ffb42d83bdc6caede807e.zip | |
libbpf: Tie struct_ops programs to kernel BTF ids, not to local ids
Enforce the following existing limitation on struct_ops programs based
on kernel BTF id instead of program-local BTF id:
struct_ops BPF prog can be re-used between multiple .struct_ops &
.struct_ops.link as long as it's the same struct_ops struct
definition and the same function pointer field
This allows reusing same BPF program for versioned struct_ops map
definitions, e.g.:
SEC("struct_ops/test")
int BPF_PROG(foo) { ... }
struct some_ops___v1 { int (*test)(void); };
struct some_ops___v2 { int (*test)(void); };
SEC(".struct_ops.link") struct some_ops___v1 a = { .test = foo }
SEC(".struct_ops.link") struct some_ops___v2 b = { .test = foo }
Signed-off-by: Eduard Zingerman <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c')
0 files changed, 0 insertions, 0 deletions
