Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /* Copyright (c) 2019 Facebook */
0003 #include <stdbool.h>
0004 #include <stddef.h>
0005 #include <linux/bpf.h>
0006 #include <linux/ptrace.h>
0007 #include <bpf/bpf_helpers.h>
0008 #include <bpf/bpf_tracing.h>
0009 
0010 struct task_struct;
0011 
0012 SEC("kprobe/__set_task_comm")
0013 int BPF_KPROBE(prog1, struct task_struct *tsk, const char *buf, bool exec)
0014 {
0015     return !tsk;
0016 }
0017 
0018 SEC("kretprobe/__set_task_comm")
0019 int BPF_KRETPROBE(prog2, int ret)
0020 {
0021     return ret;
0022 }
0023 
0024 SEC("raw_tp/task_rename")
0025 int prog3(struct bpf_raw_tracepoint_args *ctx)
0026 {
0027     return !ctx->args[0];
0028 }
0029 
0030 SEC("fentry/__set_task_comm")
0031 int BPF_PROG(prog4, struct task_struct *tsk, const char *buf, bool exec)
0032 {
0033     return 0;
0034 }
0035 
0036 SEC("fexit/__set_task_comm")
0037 int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
0038 {
0039     return 0;
0040 }
0041 
0042 char _license[] SEC("license") = "GPL";