sched_ext/selftests: Fix bpf_link leak on assertion failure
Subsystems (2)
PATCH 1/1 sched_ext/selftests: Fix bpf_link leak on assertion failure
The SCX_EQ/SCX_ASSERT/SCX_FAIL_IF macros expand to return SCX_TEST_FAIL on failure. When an assertion fires after bpf_map__attach_struct_ops() but before bpf_link__destroy(), the link leaks. Since the test runner is a single process, the leaked link keeps the BPF scheduler attached, causing subsequent tests to fail to attach their own scheduler -- cascading test failures from a single bug.
Fix by moving bpf_link__destroy() before assertions. UEI and BSS data live in the skeleton's mmap'd sections and survive link destruction, following the existing pattern in dsp_local_on.c.
--- tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c | 2 +- tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c | 2 +- tools/testing/selftests/sched_ext/exit.c | 2 +- tools/testing/selftests/sched_ext/hotplug.c | 4 ++-- tools/testing/selftests/sched_ext/numa.c | 2 +- tools/testing/selftests/sched_ext/prog_run.c | 4 ++-- tools/testing/selftests/sched_ext/rt_stall.c | 2 +- .../testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c | 2 +- .../testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c | 2 +- tools/testing/selftests/sched_ext/select_cpu_vtime.c | 3 +-- 10 files changed, 12 insertions(+), 13 deletions(-)
tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c +1 -1
@@ -35,8 +35,8 @@ static enum scx_test_status run(void *ctx)sleep (1 ); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c +1 -1
@@ -34,8 +34,8 @@ static enum scx_test_status run(void *ctx)sleep (1 ); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/exit.c +1 -1
@@ -45,11 +45,11 @@ static enum scx_test_status run(void *ctx)while (skel->data->uei.kind ==EXIT_KIND (SCX_EXIT_NONE ))sched_yield (); +bpf_link__destroy (link);SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG_BPF ));SCX_EQ (skel->data->uei.exit_code, tc);sprintf (buf,"%d" , tc);SCX_ASSERT (!strcmp (skel->data->uei.msg, buf)); -bpf_link__destroy (link);exit__destroy (skel); }
tools/testing/selftests/sched_ext/hotplug.c +2 -2
@@ -84,13 +84,13 @@ static enum scx_test_status test_hotplug(bool onlining, bool cbs_defined)while (!UEI_EXITED (skel, uei))sched_yield (); +bpf_link__destroy (link);SCX_EQ (skel->data->uei.kind, kind);SCX_EQ (UEI_REPORT (skel, uei), code);if (!onlining)toggle_online_status (1 ); -bpf_link__destroy (link);hotplug__destroy (skel);return SCX_TEST_PASS ;
@@ -124,13 +124,13 @@ static enum scx_test_status test_hotplug_attach(void)while (!UEI_EXITED (skel, uei))sched_yield (); +bpf_link__destroy (link); kind =SCX_KIND_VAL (SCX_EXIT_UNREG_KERN ); code =SCX_ECODE_VAL (SCX_ECODE_ACT_RESTART ) |SCX_ECODE_VAL (SCX_ECODE_RSN_HOTPLUG );SCX_EQ (skel->data->uei.kind, kind);SCX_EQ (UEI_REPORT (skel, uei), code); -bpf_link__destroy (link);hotplug__destroy (skel);return status;
tools/testing/selftests/sched_ext/numa.c +1 -1
@@ -36,8 +36,8 @@ static enum scx_test_status run(void *ctx)/* Just sleeping is fine, plenty of scheduling events happening */ sleep (1 ); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE ));return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/prog_run.c +2 -2
@@ -53,10 +53,10 @@ static enum scx_test_status run(void *ctx)while (skel->data->uei.kind ==EXIT_KIND (SCX_EXIT_NONE ))sched_yield (); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG_BPF )); -SCX_EQ (skel->data->uei.exit_code,0xdeadbeef );close (prog_fd);bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG_BPF )); +SCX_EQ (skel->data->uei.exit_code,0xdeadbeef );return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/rt_stall.c +1 -1
@@ -260,8 +260,8 @@ static enum scx_test_status run(void *ctx) } res =sched_stress_test (is_ext);if (is_ext) { -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); }if (!res)
tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c +1 -1
@@ -35,8 +35,8 @@ static enum scx_test_status run(void *ctx)sleep (1 ); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c +1 -1
@@ -35,8 +35,8 @@ static enum scx_test_status run(void *ctx)sleep (1 ); -SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));bpf_link__destroy (link); +SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR ));return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_vtime.c +1 -2
@@ -37,9 +37,8 @@ static enum scx_test_status run(void *ctx)sleep (1 ); -SCX_ASSERT (skel->bss->consumed); -bpf_link__destroy (link); +SCX_ASSERT (skel->bss->consumed);return SCX_TEST_PASS ; }
Signature · 1 line
2.53.0
Tejun Heo
reviewerHello,
In numa.c and rt_stall.c, the assertions check for SCX_EXIT_NONE — i.e. the scheduler ran without error. bpf_link__destroy() triggers unregistration which changes uei.kind to SCX_EXIT_UNREG, so moving it before the assertions would make them always fail. Did you run the selftests after this patch?
A simpler approach would be using __attribute__((cleanup())) to auto-destroy the link on any return path:
static inline void autolink_destroy(struct bpf_link **linkp)
{
if (*linkp)
bpf_link__destroy(*linkp);
}
#define __autolink __attribute__((cleanup(autolink_destroy)))Then each test just does:
struct bpf_link *link __autolink = bpf_map__attach_struct_ops(...);
No reordering needed — the link auto-destroys on any return, including early returns from assertion failures.
Thanks.
--
tejun
PATCH v2 1/1 sched_ext/selftests: Fix bpf_link leak on assertion failure
In reply to David CarlierThe SCX_EQ/SCX_ASSERT/SCX_FAIL_IF macros expand to return SCX_TEST_FAIL on failure. When an assertion fires after bpf_map__attach_struct_ops() but before bpf_link__destroy(), the link leaks. Since the test runner is a single process, the leaked link keeps the BPF scheduler attached, causing subsequent tests to fail to attach their own scheduler -- cascading test failures from a single bug.
Fix by introducing an __autolink cleanup attribute, as suggested by Tejun, that auto-destroys the bpf_link when the variable goes out of scope, covering both normal and early return paths. This avoids the need to reorder bpf_link__destroy() before assertions, which would break tests that assert SCX_EXIT_NONE (where the scheduler is still running and bpf_link__destroy() would trigger unregistration, changing uei.kind to SCX_EXIT_UNREG).
--- tools/testing/selftests/sched_ext/allowed_cpus.c | 3 +-- tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c | 3 +-- tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c | 3 +-- tools/testing/selftests/sched_ext/dequeue.c | 3 ++- tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c | 4 +--- tools/testing/selftests/sched_ext/enq_select_cpu.c | 3 +-- tools/testing/selftests/sched_ext/exit.c | 3 +-- tools/testing/selftests/sched_ext/hotplug.c | 6 ++---- tools/testing/selftests/sched_ext/numa.c | 3 +-- tools/testing/selftests/sched_ext/peek_dsq.c | 8 +------- tools/testing/selftests/sched_ext/prog_run.c | 3 +-- tools/testing/selftests/sched_ext/rt_stall.c | 6 ++---- tools/testing/selftests/sched_ext/scx_test.h | 8 ++++++++ tools/testing/selftests/sched_ext/select_cpu_dfl.c | 4 +--- .../selftests/sched_ext/select_cpu_dfl_nodispatch.c | 4 +--- tools/testing/selftests/sched_ext/select_cpu_dispatch.c | 4 +--- .../selftests/sched_ext/select_cpu_dispatch_bad_dsq.c | 3 +-- .../selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c | 3 +-- tools/testing/selftests/sched_ext/select_cpu_vtime.c | 4 +--- 19 files changed, 29 insertions(+), 49 deletions(-)
tools/testing/selftests/sched_ext/allowed_cpus.c +1 -2
@@ -50,7 +50,7 @@ static int test_select_cpu_from_user(const struct allowed_cpus *skel)static enum scx_test_status run (void *ctx) {struct allowed_cpus *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.allowed_cpus_ops);SCX_FAIL_IF (!link,"Failed to attach scheduler" );
@@ -62,7 +62,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/ddsp_bogus_dsq_fail.c +1 -2
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct ddsp_bogus_dsq_fail *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.ddsp_bogus_dsq_fail_ops);SCX_FAIL_IF (!link,"Failed to attach struct_ops" );
@@ -36,7 +36,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/ddsp_vtimelocal_fail.c +1 -2
@@ -27,7 +27,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct ddsp_vtimelocal_fail *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.ddsp_vtimelocal_fail_ops);SCX_FAIL_IF (!link,"Failed to attach struct_ops" );
@@ -35,7 +35,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/dequeue.c +2 -1
@@ -80,7 +80,7 @@ static void *affinity_hammer_fn(void *arg)static enum scx_test_status run_scenario (struct dequeue *skel,u32 scenario,const char *scenario_name) { -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;pid_t pids[NUM_WORKERS ];pthread_t hammer;
@@ -132,6 +132,7 @@ static enum scx_test_status run_scenario(struct dequeue *skel, u32 scenario, }bpf_link__destroy (link); + link =NULL ;SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG ));
tools/testing/selftests/sched_ext/enq_last_no_enq_fails.c +1 -3
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct enq_last_no_enq_fails *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.enq_last_no_enq_fails_ops);if (!link) {
@@ -40,8 +40,6 @@ static enum scx_test_status run(void *ctx)return SCX_TEST_FAIL ; } -bpf_link__destroy (link); -return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/enq_select_cpu.c +1 -2
@@ -52,7 +52,7 @@ static int test_select_cpu_from_user(const struct enq_select_cpu *skel)static enum scx_test_status run (void *ctx) {struct enq_select_cpu *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.enq_select_cpu_ops);if (!link) {
@@ -66,7 +66,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/exit.c +1 -2
@@ -19,7 +19,7 @@ static enum scx_test_status run(void *ctx)for (tc =0 ; tc <NUM_EXITS ; tc++) {struct exit *skel; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;char buf[16 ];/*
@@ -49,7 +49,6 @@ static enum scx_test_status run(void *ctx)SCX_EQ (skel->data->uei.exit_code, tc);sprintf (buf,"%d" , tc);SCX_ASSERT (!strcmp (skel->data->uei.msg, buf)); -bpf_link__destroy (link);exit__destroy (skel); }
tools/testing/selftests/sched_ext/hotplug.c +2 -4
@@ -43,7 +43,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status test_hotplug (bool onlining,bool cbs_defined) {struct hotplug *skel; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;long kind, code;SCX_ASSERT (is_cpu_online ());
@@ -90,7 +90,6 @@ static enum scx_test_status test_hotplug(bool onlining, bool cbs_defined)if (!onlining)toggle_online_status (1 ); -bpf_link__destroy (link);hotplug__destroy (skel);return SCX_TEST_PASS ;
@@ -99,7 +98,7 @@ static enum scx_test_status test_hotplug(bool onlining, bool cbs_defined)static enum scx_test_status test_hotplug_attach (void ) {struct hotplug *skel; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;enum scx_test_status status =SCX_TEST_PASS ;long kind, code;
@@ -130,7 +129,6 @@ static enum scx_test_status test_hotplug_attach(void)SCX_EQ (skel->data->uei.kind, kind);SCX_EQ (UEI_REPORT (skel, uei), code); -bpf_link__destroy (link);hotplug__destroy (skel);return status;
tools/testing/selftests/sched_ext/numa.c +1 -2
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct numa *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.numa_ops);SCX_FAIL_IF (!link,"Failed to attach scheduler" );
@@ -37,7 +37,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/peek_dsq.c +1 -7
@@ -84,7 +84,7 @@ static enum scx_test_status run(void *ctx)/* Enable the scheduler to test DSQ operations */ printf ("Enabling scheduler to test DSQ insert operations...\n" ); -struct bpf_link *link = + struct bpf_link *link __autolink =bpf_map__attach_struct_ops (skel->maps.peek_dsq_ops);if (!link) {
@@ -102,7 +102,6 @@ static enum scx_test_status run(void *ctx) workload_running = false;for (int j =0 ; j < i; j++)pthread_join (workload_threads[j],NULL ); -bpf_link__destroy (link);return SCX_TEST_FAIL ; } }
@@ -120,7 +119,6 @@ static enum scx_test_status run(void *ctx) workload_running = false;for (int i =0 ; i <NUM_WORKERS ; i++)pthread_join (workload_threads[i],NULL ); -bpf_link__destroy (link);return SCX_TEST_FAIL ; } }
@@ -130,7 +128,6 @@ static enum scx_test_status run(void *ctx) err =pthread_join (workload_threads[i],NULL );if (err) {SCX_ERR ("Failed to join workload thread %d: %s" , i,strerror (err)); -bpf_link__destroy (link);return SCX_TEST_FAIL ; } }
@@ -138,9 +135,6 @@ static enum scx_test_status run(void *ctx)SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); -/* Detach the scheduler */ -bpf_link__destroy (link); -printf ("Enqueue/dispatch count over %d seconds: %d / %d\n" , seconds, skel->data->enqueue_count, skel->data->dispatch_count); printf("Debug: ksym_exists=%d\n",
tools/testing/selftests/sched_ext/prog_run.c +1 -2
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct prog_run *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;int prog_fd, err =0 ; prog_fd =bpf_program__fd (skel->progs.prog_run_syscall);
@@ -56,7 +56,6 @@ static enum scx_test_status run(void *ctx)SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_UNREG_BPF ));SCX_EQ (skel->data->uei.exit_code,0xdeadbeef );close (prog_fd); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/rt_stall.c +2 -4
@@ -238,7 +238,6 @@ static bool sched_stress_test(bool is_ext)static enum scx_test_status run (void *ctx) {struct rt_stall *skel = ctx; -struct bpf_link *link =NULL ;bool res;int i;
@@ -251,6 +250,7 @@ static enum scx_test_status run(void *ctx)* - ext_server stop -> fair_server stop */ for (i =0 ; i <4 ; i++) { + struct bpf_link *link __autolink = NULL;bool is_ext = i %2 ;if (is_ext) {
@@ -259,10 +259,8 @@ static enum scx_test_status run(void *ctx)SCX_FAIL_IF (!link,"Failed to attach scheduler" ); } res =sched_stress_test (is_ext); -if (is_ext) { +if (is_ext)SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_NONE )); -bpf_link__destroy (link); - }if (!res)ksft_exit_fail ();
tools/testing/selftests/sched_ext/scx_test.h +8 -0
@@ -79,6 +79,14 @@ void scx_test_register(struct scx_test *test);scx_test_register (__test); \ } +static inline void autolink_destroy (struct bpf_link **linkp) +{ +if (*linkp) +bpf_link__destroy (*linkp); +} + +#define __autolink __attribute__((cleanup(autolink_destroy))) +#define SCX_ERR (__fmt, ...) \ do { \ fprintf(stderr, "ERR: %s:%d\n", __FILE__, __LINE__); \
tools/testing/selftests/sched_ext/select_cpu_dfl.c +1 -3
@@ -30,7 +30,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_dfl *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;pid_t pids[NUM_CHILDREN ];int i, status;
@@ -52,8 +52,6 @@ static enum scx_test_status run(void *ctx)SCX_ASSERT (!skel->bss->saw_local); -bpf_link__destroy (link); -return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_dfl_nodispatch.c +1 -3
@@ -30,7 +30,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_dfl_nodispatch *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;pid_t pids[NUM_CHILDREN ];int i, status;
@@ -52,8 +52,6 @@ static enum scx_test_status run(void *ctx)SCX_ASSERT (skel->bss->saw_local); -bpf_link__destroy (link); -return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_dispatch.c +1 -3
@@ -30,7 +30,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_dispatch *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;pid_t pids[NUM_CHILDREN ];int i, status;
@@ -50,8 +50,6 @@ static enum scx_test_status run(void *ctx)SCX_EQ (status,0 ); } -bpf_link__destroy (link); -return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_dispatch_bad_dsq.c +1 -2
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_dispatch_bad_dsq *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.select_cpu_dispatch_bad_dsq_ops);SCX_FAIL_IF (!link,"Failed to attach scheduler" );
@@ -36,7 +36,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_dispatch_dbl_dsp.c +1 -2
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_dispatch_dbl_dsp *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL; link =bpf_map__attach_struct_ops (skel->maps.select_cpu_dispatch_dbl_dsp_ops);SCX_FAIL_IF (!link,"Failed to attach scheduler" );
@@ -36,7 +36,6 @@ static enum scx_test_status run(void *ctx)sleep (1 );SCX_EQ (skel->data->uei.kind,EXIT_KIND (SCX_EXIT_ERROR )); -bpf_link__destroy (link);return SCX_TEST_PASS ; }
tools/testing/selftests/sched_ext/select_cpu_vtime.c +1 -3
@@ -28,7 +28,7 @@ static enum scx_test_status setup(void **ctx)static enum scx_test_status run (void *ctx) {struct select_cpu_vtime *skel = ctx; -struct bpf_link *link; + struct bpf_link *link __autolink = NULL;SCX_ASSERT (!skel->bss->consumed);
@@ -39,8 +39,6 @@ static enum scx_test_status run(void *ctx)SCX_ASSERT (skel->bss->consumed); -bpf_link__destroy (link); -return SCX_TEST_PASS ; }
Signature · 1 line
2.53.0