xref: /linux/tools/testing/selftests/bpf/progs/test_signed_loader_data.c (revision 6d177908bad5992e17669030db41caab88041d5e)
1 // SPDX-License-Identifier: GPL-2.0
2 #include "vmlinux.h"
3 #include <bpf/bpf_helpers.h>
4 
5 /*
6  * A single initialized global, so the generated loader has one internal
7  * (.data) map that it seeds with an initial value while loading.
8  * prog_tests/signed_loader.c uses this to check that a signed loader
9  * keeps the attested contents and ignores a ctx-supplied initial_value:
10  * the host cannot re-seed a signed program's maps through the loader ctx.
11  */
12 __u64 magic = 0x5eed1234abad1deaULL;
13 
14 SEC("socket")
15 int probe(void *ctx)
16 {
17 	return (int)magic;
18 }
19 
20 char _license[] SEC("license") = "GPL";
21