tools/testing/selftests/bpf/progs/test_signed_loader_data.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_signed_loader_data.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/test_signed_loader_data.c
Extension
.c
Size
589 bytes
Lines
21
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: implementation source
Status
source implementation candidate

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
#include "vmlinux.h"
#include <bpf/bpf_helpers.h>

/*
 * A single initialized global, so the generated loader has one internal
 * (.data) map that it seeds with an initial value while loading.
 * prog_tests/signed_loader.c uses this to check that a signed loader
 * keeps the attested contents and ignores a ctx-supplied initial_value:
 * the host cannot re-seed a signed program's maps through the loader ctx.
 */
__u64 magic = 0x5eed1234abad1deaULL;

SEC("socket")
int probe(void *ctx)
{
	return (int)magic;
}

char _license[] SEC("license") = "GPL";

Annotation

Implementation Notes