1 // SPDX-License-Identifier: GPL-2.0 2 #include "vmlinux.h" 3 #include <bpf/bpf_helpers.h> 4 5 /* 6 * One explicit array map and no global variables, so the generated loader 7 * has exactly one map to create (no .rodata/.bss). prog_tests/signed_loader.c 8 * uses this to check that a signed loader ignores ctx-supplied max_entries: 9 * the map must keep its attested size (4), not whatever the host puts in 10 * the loader ctx. 11 */ 12 struct { 13 __uint(type, BPF_MAP_TYPE_ARRAY); 14 __uint(max_entries, 4); 15 __type(key, __u32); 16 __type(value, __u64); 17 } amap SEC(".maps"); 18 19 SEC("socket") 20 int probe(void *ctx) 21 { 22 __u32 key = 0; 23 __u64 *val = bpf_map_lookup_elem(&amap, &key); 24 25 return val ? (int)*val : 0; 26 } 27 28 char _license[] SEC("license") = "GPL"; 29