xref: /linux/tools/testing/selftests/bpf/progs/kprobe_multi_verifier.c (revision cf87766dd6f9ddcceaa8ee26e3cbd7538e42dd19)
1 // SPDX-License-Identifier: GPL-2.0
2 #include "vmlinux.h"
3 #include <bpf/bpf_helpers.h>
4 #include <bpf/bpf_tracing.h>
5 #include <bpf/usdt.bpf.h>
6 #include "bpf_misc.h"
7 
8 char _license[] SEC("license") = "GPL";
9 
10 
11 SEC("kprobe.session")
12 __success
13 int kprobe_session_return_0(struct pt_regs *ctx)
14 {
15 	return 0;
16 }
17 
18 SEC("kprobe.session")
19 __success
20 int kprobe_session_return_1(struct pt_regs *ctx)
21 {
22 	return 1;
23 }
24 
25 SEC("kprobe.session")
26 __failure
27 __msg("At program exit the register R0 has smin=2 smax=2 should have been in [0, 1]")
28 int kprobe_session_return_2(struct pt_regs *ctx)
29 {
30 	return 2;
31 }
32