1 // SPDX-License-Identifier: GPL-2.0 2 /* Copyright (c) 2022 Facebook */ 3 4 #include "vmlinux.h" 5 #include <bpf/bpf_helpers.h> 6 #include <bpf/bpf_tracing.h> 7 8 const volatile int my_pid; 9 10 bool abc1_called; 11 bool abc2_called; 12 bool custom1_called; 13 bool custom2_called; 14 bool kprobe1_called; 15 bool xyz_called; 16 17 SEC("abc") 18 int abc1(void *ctx) 19 { 20 abc1_called = true; 21 return 0; 22 } 23 24 SEC("abc/whatever") 25 int abc2(void *ctx) 26 { 27 abc2_called = true; 28 return 0; 29 } 30 31 SEC("custom") 32 int custom1(void *ctx) 33 { 34 custom1_called = true; 35 return 0; 36 } 37 38 SEC("custom/something") 39 int custom2(void *ctx) 40 { 41 custom2_called = true; 42 return 0; 43 } 44 45 SEC("kprobe") 46 int kprobe1(void *ctx) 47 { 48 kprobe1_called = true; 49 return 0; 50 } 51 52 SEC("xyz/blah") 53 int xyz(void *ctx) 54 { 55 int whatever; 56 57 /* use sleepable helper, custom handler should set sleepable flag */ 58 bpf_copy_from_user(&whatever, sizeof(whatever), NULL); 59 xyz_called = true; 60 return 0; 61 } 62 63 char _license[] SEC("license") = "GPL"; 64