1 // SPDX-License-Identifier: GPL-2.0 2 #include <linux/bpf.h> 3 #include <bpf/bpf_helpers.h> 4 #include <bpf/bpf_tracing.h> 5 6 char _license[] SEC("license") = "GPL"; 7 8 int pid = 0; 9 10 SEC("kprobe.multi") 11 int test_override(struct pt_regs *ctx) 12 { 13 if (bpf_get_current_pid_tgid() >> 32 != pid) 14 return 0; 15 16 bpf_override_return(ctx, 123); 17 return 0; 18 } 19 20 SEC("kprobe") 21 int test_kprobe_override(struct pt_regs *ctx) 22 { 23 if (bpf_get_current_pid_tgid() >> 32 != pid) 24 return 0; 25 26 bpf_override_return(ctx, 123); 27 return 0; 28 } 29