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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/progs/test_global_func10.c
Extension
.c
Size
601 bytes
Lines
36
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

struct Small {
	long x;
};

struct Big {
	long x;
	long y;
};

__noinline int foo(const struct Big *big)
{
	if (!big)
		return 0;

	return bpf_get_prandom_u32() < big->y;
}

SEC("cgroup_skb/ingress")
__failure __msg("invalid read from stack")
int global_func10(struct __sk_buff *skb)
{
	const struct Small small = {.x = skb->len };

	return foo((struct Big *)&small) ? 1 : 0;
}

Annotation

Implementation Notes