1// SPDX-License-Identifier: GPL-2.0
2/* Copyright (c) 2020 Facebook */
3
4#include "vmlinux.h"
5#include <bpf/bpf_helpers.h>
6#include <bpf/bpf_tracing.h>
7#include <bpf/bpf_core_read.h>
8
9bool prog1_called = false;
10bool prog2_called = false;
11bool prog3_called = false;
12
13SEC("raw_tp/sys_enter")
14int prog1(const void *ctx)
15{
16	prog1_called = true;
17	return 0;
18}
19
20SEC("raw_tp/sys_exit")
21int prog2(const void *ctx)
22{
23	prog2_called = true;
24	return 0;
25}
26
27struct fake_kernel_struct {
28	int whatever;
29} __attribute__((preserve_access_index));
30
31SEC("fentry/unexisting-kprobe-will-fail-if-loaded")
32int prog3(const void *ctx)
33{
34	struct fake_kernel_struct *fake = (void *)ctx;
35	fake->whatever = 123;
36	prog3_called = true;
37	return 0;
38}
39
40char _license[] SEC("license") = "GPL";
41