xref: /linux/tools/testing/selftests/bpf/verifier/sleepable.c (revision e7d759f31ca295d589f7420719c311870bb3166f)
1 {
2 	"sleepable fentry accept",
3 	.insns = {
4 	BPF_MOV64_IMM(BPF_REG_0, 0),
5 	BPF_EXIT_INSN(),
6 	},
7 	.prog_type = BPF_PROG_TYPE_TRACING,
8 	.expected_attach_type = BPF_TRACE_FENTRY,
9 	.kfunc = "bpf_fentry_test1",
10 	.result = ACCEPT,
11 	.flags = BPF_F_SLEEPABLE,
12 	.runs = -1,
13 },
14 {
15 	"sleepable fexit accept",
16 	.insns = {
17 	BPF_MOV64_IMM(BPF_REG_0, 0),
18 	BPF_EXIT_INSN(),
19 	},
20 	.prog_type = BPF_PROG_TYPE_TRACING,
21 	.expected_attach_type = BPF_TRACE_FENTRY,
22 	.kfunc = "bpf_fentry_test1",
23 	.result = ACCEPT,
24 	.flags = BPF_F_SLEEPABLE,
25 	.runs = -1,
26 },
27 {
28 	"sleepable fmod_ret accept",
29 	.insns = {
30 	BPF_MOV64_IMM(BPF_REG_0, 0),
31 	BPF_EXIT_INSN(),
32 	},
33 	.prog_type = BPF_PROG_TYPE_TRACING,
34 	.expected_attach_type = BPF_MODIFY_RETURN,
35 	.kfunc = "bpf_fentry_test1",
36 	.result = ACCEPT,
37 	.flags = BPF_F_SLEEPABLE,
38 	.runs = -1,
39 },
40 {
41 	"sleepable iter accept",
42 	.insns = {
43 	BPF_MOV64_IMM(BPF_REG_0, 0),
44 	BPF_EXIT_INSN(),
45 	},
46 	.prog_type = BPF_PROG_TYPE_TRACING,
47 	.expected_attach_type = BPF_TRACE_ITER,
48 	.kfunc = "task",
49 	.result = ACCEPT,
50 	.flags = BPF_F_SLEEPABLE,
51 	.runs = -1,
52 },
53 {
54 	"sleepable lsm accept",
55 	.insns = {
56 	BPF_MOV64_IMM(BPF_REG_0, 0),
57 	BPF_EXIT_INSN(),
58 	},
59 	.prog_type = BPF_PROG_TYPE_LSM,
60 	.kfunc = "bpf",
61 	.expected_attach_type = BPF_LSM_MAC,
62 	.result = ACCEPT,
63 	.flags = BPF_F_SLEEPABLE,
64 	.runs = -1,
65 },
66 {
67 	"sleepable uprobe accept",
68 	.insns = {
69 	BPF_MOV64_IMM(BPF_REG_0, 0),
70 	BPF_EXIT_INSN(),
71 	},
72 	.prog_type = BPF_PROG_TYPE_KPROBE,
73 	.kfunc = "bpf_fentry_test1",
74 	.result = ACCEPT,
75 	.flags = BPF_F_SLEEPABLE,
76 	.runs = -1,
77 },
78 {
79 	"sleepable raw tracepoint reject",
80 	.insns = {
81 	BPF_MOV64_IMM(BPF_REG_0, 0),
82 	BPF_EXIT_INSN(),
83 	},
84 	.prog_type = BPF_PROG_TYPE_TRACING,
85 	.expected_attach_type = BPF_TRACE_RAW_TP,
86 	.kfunc = "sched_switch",
87 	.result = REJECT,
88 	.errstr = "Only fentry/fexit/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable",
89 	.flags = BPF_F_SLEEPABLE,
90 	.runs = -1,
91 },
92