1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/bpf.h> 3 #include <bpf/bpf_helpers.h> 4 #include "bpf_misc.h" 5 #include "bpf_test_utils.h" 6 7 struct { 8 __uint(type, BPF_MAP_TYPE_PROG_ARRAY); 9 __uint(max_entries, 1); 10 __uint(key_size, sizeof(__u32)); 11 __array(values, void (void)); 12 } jmp_table SEC(".maps"); 13 14 SEC("?uprobe") 15 int uprobe_normal(void *ctx) 16 { 17 bpf_tail_call_static(ctx, &jmp_table, 0); 18 return 0; 19 } 20 21 SEC("?uprobe.s") 22 int uprobe_sleepable_1(void *ctx) 23 { 24 bpf_tail_call_static(ctx, &jmp_table, 0); 25 return 0; 26 } 27 28 int executed = 0; 29 int my_pid = 0; 30 31 SEC("?uprobe.s") 32 int uprobe_sleepable_2(void *ctx) 33 { 34 int pid = bpf_get_current_pid_tgid() >> 32; 35 36 if (pid != my_pid) 37 return 0; 38 39 executed++; 40 return 0; 41 } 42 43 char __license[] SEC("license") = "GPL"; 44