18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* Copyright (c) 2020 Facebook */ 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ci#include "vmlinux.h" 58c2ecf20Sopenharmony_ci#include <bpf/bpf_helpers.h> 68c2ecf20Sopenharmony_ci#include <bpf/bpf_tracing.h> 78c2ecf20Sopenharmony_ci#include <bpf/bpf_core_read.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_cibool prog1_called = false; 108c2ecf20Sopenharmony_cibool prog2_called = false; 118c2ecf20Sopenharmony_cibool prog3_called = false; 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ciSEC("raw_tp/sys_enter") 148c2ecf20Sopenharmony_ciint prog1(const void *ctx) 158c2ecf20Sopenharmony_ci{ 168c2ecf20Sopenharmony_ci prog1_called = true; 178c2ecf20Sopenharmony_ci return 0; 188c2ecf20Sopenharmony_ci} 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ciSEC("raw_tp/sys_exit") 218c2ecf20Sopenharmony_ciint prog2(const void *ctx) 228c2ecf20Sopenharmony_ci{ 238c2ecf20Sopenharmony_ci prog2_called = true; 248c2ecf20Sopenharmony_ci return 0; 258c2ecf20Sopenharmony_ci} 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_cistruct fake_kernel_struct { 288c2ecf20Sopenharmony_ci int whatever; 298c2ecf20Sopenharmony_ci} __attribute__((preserve_access_index)); 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciSEC("fentry/unexisting-kprobe-will-fail-if-loaded") 328c2ecf20Sopenharmony_ciint prog3(const void *ctx) 338c2ecf20Sopenharmony_ci{ 348c2ecf20Sopenharmony_ci struct fake_kernel_struct *fake = (void *)ctx; 358c2ecf20Sopenharmony_ci fake->whatever = 123; 368c2ecf20Sopenharmony_ci prog3_called = true; 378c2ecf20Sopenharmony_ci return 0; 388c2ecf20Sopenharmony_ci} 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_cichar _license[] SEC("license") = "GPL"; 41