root/tools/testing/selftests/bpf/progs/test_core_reloc_ptr_as_arr.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. SEC

   1 // SPDX-License-Identifier: GPL-2.0
   2 // Copyright (c) 2019 Facebook
   3 
   4 #include <linux/bpf.h>
   5 #include <stdint.h>
   6 #include "bpf_helpers.h"
   7 
   8 char _license[] SEC("license") = "GPL";
   9 
  10 static volatile struct data {
  11         char in[256];
  12         char out[256];
  13 } data;
  14 
  15 struct core_reloc_ptr_as_arr {
  16         int a;
  17 };
  18 
  19 SEC("raw_tracepoint/sys_enter")
  20 int test_core_ptr_as_arr(void *ctx)
  21 {
  22         struct core_reloc_ptr_as_arr *in = (void *)&data.in;
  23         struct core_reloc_ptr_as_arr *out = (void *)&data.out;
  24 
  25         if (BPF_CORE_READ(&out->a, &in[2].a))
  26                 return 1;
  27 
  28         return 0;
  29 }
  30 

/* [<][>][^][v][top][bottom][index][help] */