Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2019 Facebook */
3#include "vmlinux.h"
4#include <bpf/bpf_helpers.h>
5#include <bpf/bpf_tracing.h>
6
7struct task_struct;
8
9SEC("kprobe/__set_task_comm")
10int BPF_KPROBE(prog1, struct task_struct *tsk, const char *buf, bool exec)
11{
12 return !tsk;
13}
14
15SEC("kretprobe/__set_task_comm")
16int BPF_KRETPROBE(prog2, int ret)
17{
18 return ret;
19}
20
21SEC("raw_tp/task_rename")
22int prog3(struct bpf_raw_tracepoint_args *ctx)
23{
24 return !ctx->args[0];
25}
26
27SEC("fentry/__set_task_comm")
28int BPF_PROG(prog4, struct task_struct *tsk, const char *buf, bool exec)
29{
30 return 0;
31}
32
33SEC("fexit/__set_task_comm")
34int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)
35{
36 return 0;
37}
38
39char _license[] SEC("license") = "GPL";