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

loop5.c (449B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Copyright (c) 2019 Facebook
      3#include <linux/bpf.h>
      4#include <bpf/bpf_helpers.h>
      5
      6char _license[] SEC("license") = "GPL";
      7
      8SEC("socket")
      9int while_true(volatile struct __sk_buff* skb)
     10{
     11	int i = 0;
     12
     13	while (1) {
     14		if (skb->len)
     15			i += 3;
     16		else
     17			i += 7;
     18		if (i == 9)
     19			break;
     20		barrier();
     21		if (i == 10)
     22			break;
     23		barrier();
     24		if (i == 13)
     25			break;
     26		barrier();
     27		if (i == 14)
     28			break;
     29	}
     30	return i;
     31}