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_global_func16.c (329B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2#include <stddef.h>
      3#include <linux/bpf.h>
      4#include <bpf/bpf_helpers.h>
      5
      6__noinline int foo(int (*arr)[10])
      7{
      8	if (arr)
      9		return (*arr)[9];
     10
     11	return 0;
     12}
     13
     14SEC("cgroup_skb/ingress")
     15int test_cls(struct __sk_buff *skb)
     16{
     17	int array[10];
     18
     19	const int rv = foo(&array);
     20
     21	return rv ? 1 : 0;
     22}