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_func15.c (315B)


      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(unsigned int *v)
      7{
      8	if (v)
      9		*v = bpf_get_prandom_u32();
     10
     11	return 0;
     12}
     13
     14SEC("cgroup_skb/ingress")
     15int test_cls(struct __sk_buff *skb)
     16{
     17	unsigned int v = 1;
     18
     19	foo(&v);
     20
     21	return v;
     22}