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

loop3.c (491B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Copyright (c) 2019 Facebook
      3#include <linux/sched.h>
      4#include <linux/ptrace.h>
      5#include <stdint.h>
      6#include <stddef.h>
      7#include <stdbool.h>
      8#include <linux/bpf.h>
      9#include <bpf/bpf_helpers.h>
     10#include <bpf/bpf_tracing.h>
     11
     12char _license[] SEC("license") = "GPL";
     13
     14SEC("raw_tracepoint/consume_skb")
     15int while_true(struct pt_regs *ctx)
     16{
     17	volatile __u64 i = 0, sum = 0;
     18	do {
     19		i++;
     20		sum += PT_REGS_RC(ctx);
     21	} while (i < 0x100000000ULL);
     22	return sum;
     23}