cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

test_ksyms.c (825B)


      1// SPDX-License-Identifier: GPL-2.0
      2/* Copyright (c) 2019 Facebook */
      3
      4#include <stdbool.h>
      5#include <linux/bpf.h>
      6#include <bpf/bpf_helpers.h>
      7
      8__u64 out__bpf_link_fops = -1;
      9__u64 out__bpf_link_fops1 = -1;
     10__u64 out__btf_size = -1;
     11__u64 out__per_cpu_start = -1;
     12
     13extern const void bpf_link_fops __ksym;
     14extern const void __start_BTF __ksym;
     15extern const void __stop_BTF __ksym;
     16extern const void __per_cpu_start __ksym;
     17/* non-existing symbol, weak, default to zero */
     18extern const void bpf_link_fops1 __ksym __weak;
     19
     20SEC("raw_tp/sys_enter")
     21int handler(const void *ctx)
     22{
     23	out__bpf_link_fops = (__u64)&bpf_link_fops;
     24	out__btf_size = (__u64)(&__stop_BTF - &__start_BTF);
     25	out__per_cpu_start = (__u64)&__per_cpu_start;
     26
     27	out__bpf_link_fops1 = (__u64)&bpf_link_fops1;
     28
     29	return 0;
     30}
     31
     32char _license[] SEC("license") = "GPL";