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_func14.c (325B)


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