]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: Add timer lockup selftest
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 11 Jul 2024 05:27:09 +0000 (05:27 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 11 Jul 2024 08:18:31 +0000 (10:18 +0200)
commit50bd5a0c658d132507673c4d59347c025dd149ed
tree065eafc4e3328e68157f744c675c1e6f749bd316
parent0c237341d994adbafed2a0d372275de39efa4a98
selftests/bpf: Add timer lockup selftest

Add a selftest that tries to trigger a situation where two timer callbacks
are attempting to cancel each other's timer. By running them continuously,
we hit a condition where both run in parallel and cancel each other.

Without the fix in the previous patch, this would cause a lockup as
hrtimer_cancel on either side will wait for forward progress from the
callback.

Ensure that this situation leads to a EDEADLK error.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240711052709.2148616-1-memxor@gmail.com
tools/testing/selftests/bpf/prog_tests/timer_lockup.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/timer_lockup.c [new file with mode: 0644]