xref: /linux/tools/testing/selftests/bpf/progs/test_sleepable_tracepoints_fail.c (revision b2128290c29902315e632ea59e0504d6bc9e9b42)
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2025 Meta Platforms, Inc. and affiliates. */
3 
4 #include <vmlinux.h>
5 #include <bpf/bpf_tracing.h>
6 #include <bpf/bpf_helpers.h>
7 #include "bpf_misc.h"
8 
9 char _license[] SEC("license") = "GPL";
10 
11 /* Sleepable program on a non-faultable tracepoint should fail to load */
12 SEC("tp_btf.s/sched_switch")
13 __failure __msg("Sleepable program cannot attach to non-faultable tracepoint")
14 int BPF_PROG(handle_sched_switch, bool preempt,
15 	     struct task_struct *prev, struct task_struct *next)
16 {
17 	return 0;
18 }
19