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_func8.c (332B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2/* Copyright (c) 2020 Facebook */
      3#include <stddef.h>
      4#include <linux/bpf.h>
      5#include <bpf/bpf_helpers.h>
      6
      7__noinline int foo(struct __sk_buff *skb)
      8{
      9	return bpf_get_prandom_u32();
     10}
     11
     12SEC("cgroup_skb/ingress")
     13int test_cls(struct __sk_buff *skb)
     14{
     15	if (!foo(skb))
     16		return 0;
     17
     18	return 1;
     19}