summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAmery Hung <ameryhung@gmail.com>2025-12-03 15:37:48 -0800
committerAndrii Nakryiko <andrii@kernel.org>2025-12-05 16:17:58 -0800
commit0e841d19263ab6e1ca2b280109832f57624e48d1 (patch)
tree0c9f7ea1f63bfa3a178c7d9383fefb6dff62c43d /include/linux
parent04fd12df4e05dd6fd3017b637f6fbc9da10b4e65 (diff)
selftests/bpf: Test getting associated struct_ops in timer callback
Make sure 1) a timer callback can also reference the associated struct_ops, and then make sure 2) the timer callback cannot get a dangled pointer to the struct_ops when the map is freed. The test schedules a timer callback from a struct_ops program since struct_ops programs do not pin the map. It is possible for the timer callback to run after the map is freed. The timer callback calls a kfunc that runs .test_1() of the associated struct_ops, which should return MAP_MAGIC when the map is still alive or -1 when the map is gone. The first subtest added in this patch schedules the timer callback to run immediately, while the map is still alive. The second subtest added schedules the callback to run 500ms after syscall_prog runs and then frees the map right after syscall_prog runs. Both subtests then wait until the callback runs to check the return of the kfunc. Signed-off-by: Amery Hung <ameryhung@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20251203233748.668365-7-ameryhung@gmail.com
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions