1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */ 3 #include <test_progs.h> 4 #include "timer_start_deadlock.skel.h" 5 6 void test_timer_start_deadlock(void) 7 { 8 struct timer_start_deadlock *skel; 9 int err, prog_fd; 10 LIBBPF_OPTS(bpf_test_run_opts, opts); 11 12 skel = timer_start_deadlock__open_and_load(); 13 if (!ASSERT_OK_PTR(skel, "skel_open_and_load")) 14 return; 15 16 err = timer_start_deadlock__attach(skel); 17 if (!ASSERT_OK(err, "skel_attach")) 18 goto cleanup; 19 20 prog_fd = bpf_program__fd(skel->progs.start_timer); 21 22 /* 23 * Run the syscall program that attempts to deadlock. 24 * If the kernel deadlocks, this call will never return. 25 */ 26 err = bpf_prog_test_run_opts(prog_fd, &opts); 27 ASSERT_OK(err, "prog_test_run"); 28 ASSERT_EQ(opts.retval, 0, "prog_retval"); 29 30 ASSERT_EQ(skel->bss->tp_called, 1, "tp_called"); 31 cleanup: 32 timer_start_deadlock__destroy(skel); 33 } 34