tools/testing/selftests/bpf/prog_tests/test_struct_ops_no_cfi.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/test_struct_ops_no_cfi.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/test_struct_ops_no_cfi.c- Extension
.c- Size
- 850 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
test_progs.htesting_helpers.h
Detected Declarations
function load_bpf_test_no_cfifunction test_struct_ops_no_cfi
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
#include <test_progs.h>
#include <testing_helpers.h>
static void load_bpf_test_no_cfi(void)
{
int fd;
int err;
fd = open("bpf_test_no_cfi.ko", O_RDONLY);
if (!ASSERT_GE(fd, 0, "open"))
return;
/* The module will try to register a struct_ops type without
* cfi_stubs and with cfi_stubs.
*
* The one without cfi_stub should fail. The module will be loaded
* successfully only if the result of the registration is as
* expected, or it fails.
*/
err = finit_module(fd, "", 0);
close(fd);
if (!ASSERT_OK(err, "finit_module"))
return;
err = delete_module("bpf_test_no_cfi", 0);
ASSERT_OK(err, "delete_module");
}
void test_struct_ops_no_cfi(void)
{
if (test__start_subtest("load_bpf_test_no_cfi"))
load_bpf_test_no_cfi();
}
Annotation
- Immediate include surface: `test_progs.h`, `testing_helpers.h`.
- Detected declarations: `function load_bpf_test_no_cfi`, `function test_struct_ops_no_cfi`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.