diff options
author | Amery Hung <[email protected]> | 2024-08-27 01:13:01 +0000 |
---|---|---|
committer | Alexei Starovoitov <[email protected]> | 2024-08-29 12:18:26 -0700 |
commit | bd0b4836a2333d5c725397d458c8edfa66f1d9bb (patch) | |
tree | 70b91ce44d79541d940dd4010bf1f6be03dcd1d6 /tools/perf/scripts/python/libxed.py | |
parent | c634d6f4e12d00c954410ba11db45799a8c77b5b (diff) |
selftests/bpf: Make sure stashed kptr in local kptr is freed recursively
When dropping a local kptr, any kptr stashed into it is supposed to be
freed through bpf_obj_free_fields->__bpf_obj_drop_impl recursively. Add a
test to make sure it happens.
The test first stashes a referenced kptr to "struct task" into a local
kptr and gets the reference count of the task. Then, it drops the local
kptr and reads the reference count of the task again. Since
bpf_obj_free_fields and __bpf_obj_drop_impl will go through the local kptr
recursively during bpf_obj_drop, the dtor of the stashed task kptr should
eventually be called. The second reference count should be one less than
the first one.
Signed-off-by: Amery Hung <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/libxed.py')
0 files changed, 0 insertions, 0 deletions