tools/testing/selftests/bpf/prog_tests/cgroup_storage.c

Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/cgroup_storage.c

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/bpf/prog_tests/cgroup_storage.c
Extension
.c
Size
3834 bytes
Lines
144
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

/* Create a socket to trigger cgroup/sock_create hook.
	 * This will execute our BPF program and trigger the OOB read
	 * if the bug is present (before the fix).
	 */
	sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
	if (!ASSERT_OK_FD(sock_fd, "create socket"))
		goto cleanup_skel;

	close(sock_fd);

	/* If we reach here without a kernel panic or KASAN report,
	 * the test passes (the fix is working).
	 */

cleanup_skel:
	cgroup_storage__destroy(skel);
cleanup_cgroup:
	close(cgroup_fd);
	cleanup_cgroup_environment();
}

Annotation

Implementation Notes