diff options
| author | Dave Marchevsky <[email protected]> | 2023-04-15 20:18:08 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2023-04-16 00:36:50 +0000 |
| commit | de67ba3968fa1455e8020b21e5ccc2bb48b9a852 (patch) | |
| tree | 8ed4f94edaf80f02f1e45b1122c303f32f669e42 /tools/testing/selftests/bpf/prog_tests/tracing_struct.c | |
| parent | bpf: Migrate bpf_rbtree_add and bpf_list_push_{front,back} to possibly fail (diff) | |
| download | kernel-de67ba3968fa1455e8020b21e5ccc2bb48b9a852.tar.gz kernel-de67ba3968fa1455e8020b21e5ccc2bb48b9a852.zip | |
selftests/bpf: Modify linked_list tests to work with macro-ified inserts
The linked_list tests use macros and function pointers to reduce code
duplication. Earlier in the series, bpf_list_push_{front,back} were
modified to be macros, expanding to invoke actual kfuncs
bpf_list_push_{front,back}_impl. Due to this change, a code snippet
like:
void (*p)(void *, void *) = (void *)&bpf_list_##op;
p(hexpr, nexpr);
meant to do bpf_list_push_{front,back}(hexpr, nexpr), will no longer
work as it's no longer valid to do &bpf_list_push_{front,back} since
they're no longer functions.
This patch fixes issues of this type, along with two other minor changes
- one improvement and one fix - both related to the node argument to
list_push_{front,back}.
* The fix: migration of list_push tests away from (void *, void *)
func ptr uncovered that some tests were incorrectly passing pointer
to node, not pointer to struct bpf_list_node within the node. This
patch fixes such issues (CHECK(..., f) -> CHECK(..., &f->node))
* The improvement: In linked_list tests, the struct foo type has two
list_node fields: node and node2, at byte offsets 0 and 40 within
the struct, respectively. Currently node is used in ~all tests
involving struct foo and lists. The verifier needs to do some work
to account for the offset of bpf_list_node within the node type, so
using node2 instead of node exercises that logic more in the tests.
This patch migrates linked_list tests to use node2 instead of node.
Signed-off-by: Dave Marchevsky <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/tracing_struct.c')
0 files changed, 0 insertions, 0 deletions
