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_xdp_context_test_run.c (417B)


      1// SPDX-License-Identifier: GPL-2.0
      2#include <linux/bpf.h>
      3#include <bpf/bpf_helpers.h>
      4
      5SEC("xdp")
      6int xdp_context(struct xdp_md *xdp)
      7{
      8	void *data = (void *)(long)xdp->data;
      9	__u32 *metadata = (void *)(long)xdp->data_meta;
     10	__u32 ret;
     11
     12	if (metadata + 1 > data)
     13		return XDP_ABORTED;
     14	ret = *metadata;
     15	if (bpf_xdp_adjust_meta(xdp, 4))
     16		return XDP_ABORTED;
     17	return ret;
     18}
     19
     20char _license[] SEC("license") = "GPL";