diff options
| author | Qiliang Yuan <odys.yuan@gmail.com> | 2026-10-22 16:48:39 +0800 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-10-24 03:48:42 +0000 |
| commit | ac3df711a428a9ff4277100ee26c6765e8f80a3b (patch) | |
| tree | b18719b78fc5f3683a975dc44ab268a681e32e40 /include/linux/timerqueue.h | |
| parent | a451867eb5f645a199d0f70cb2b1f541e07f33ec (diff) | |
selftests/bpf: Wait for the struct_ops map to be freed in assoc_in_timer
st_ops_assoc_in_timer_no_uref runs .test_1, which starts a timer to
call it again 500ms later, drops every reference to the struct_ops map,
and expects the timer callback to find no struct_ops associated with
its program anymore.
The association goes away only when the last reference to the map is
dropped. syscall_prog holds one through its own association and drops
it only when it is freed, in a work item after an RCU tasks trace grace
period. With other tests running in parallel, that can take longer than
500ms, and the callback still reaches the struct_ops and gets MAP_MAGIC
instead of -1.
Have the timer callback restart the timer until the map is gone, as it
does for st_ops_assoc_in_timer_free. Calling the struct_ops through the
association until then is safe, as the map is freed only after a grace
period that follows clearing the association.
st_ops_assoc_in_timer_no_uref run 100 times with test_progs -j32 running
in the background, on a KASAN kernel with the fix, x86_64 VM with 32
vCPUs, before and after this patch:
before after
outcome 2 of 100 failed (MAP_MAGIC) 0 of 100 failed (MAP_MAGIC)
Fixes: 0e841d19263a ("selftests/bpf: Test getting associated struct_ops in timer callback")
Signed-off-by: Qiliang Yuan <odys.yuan@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://patch.msgid.link/20261022-selftests-bpf-struct-ops-assoc-timer-v6-4-2c0f18e82582@gmail.com
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
