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_skb_ctx.c (597B)


      1// SPDX-License-Identifier: GPL-2.0
      2
      3#include <linux/bpf.h>
      4#include <bpf/bpf_helpers.h>
      5
      6char _license[] SEC("license") = "GPL";
      7
      8SEC("tc")
      9int process(struct __sk_buff *skb)
     10{
     11	#pragma clang loop unroll(full)
     12	for (int i = 0; i < 5; i++) {
     13		if (skb->cb[i] != i + 1)
     14			return 1;
     15		skb->cb[i]++;
     16	}
     17	skb->priority++;
     18	skb->tstamp++;
     19	skb->mark++;
     20
     21	if (skb->wire_len != 100)
     22		return 1;
     23	if (skb->gso_segs != 8)
     24		return 1;
     25	if (skb->gso_size != 10)
     26		return 1;
     27	if (skb->ingress_ifindex != 11)
     28		return 1;
     29	if (skb->ifindex != 1)
     30		return 1;
     31	if (skb->hwtstamp != 11)
     32		return 1;
     33
     34	return 0;
     35}