tools/testing/selftests/bpf/prog_tests/arena_direct_value.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/prog_tests/arena_direct_value.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/prog_tests/arena_direct_value.c- Extension
.c- Size
- 1745 bytes
- Lines
- 74
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
test_progs.hbpf/bpf.herrno.hsys/mman.hunistd.h
Detected Declarations
function test_arena_direct_value_one_past_endfunction test_arena_direct_value
Annotated Snippet
if (errno == EOPNOTSUPP) {
test__skip();
return;
}
ASSERT_GE(map_fd, 0, "bpf_map_create");
return;
}
arena = mmap(NULL, arena_sz, PROT_READ | PROT_WRITE, MAP_SHARED, map_fd, 0);
if (!ASSERT_NEQ(arena, MAP_FAILED, "arena_mmap"))
goto cleanup;
insns[0].imm = map_fd;
insns[1].imm = arena_sz;
prog_fd = bpf_prog_load(BPF_PROG_TYPE_RAW_TRACEPOINT,
"arena_direct_value", "GPL", insns,
ARRAY_SIZE(insns), &prog_opts);
if (!ASSERT_LT(prog_fd, 0, "prog_load")) {
close(prog_fd);
goto cleanup;
}
snprintf(expected, sizeof(expected),
"invalid access to map value pointer, value_size=0 off=%u",
arena_sz);
ASSERT_HAS_SUBSTR(log_buf, expected, "verifier_log");
cleanup:
if (arena != MAP_FAILED)
munmap(arena, arena_sz);
close(map_fd);
}
void test_arena_direct_value(void)
{
if (test__start_subtest("one_past_end"))
test_arena_direct_value_one_past_end();
}
Annotation
- Immediate include surface: `test_progs.h`, `bpf/bpf.h`, `errno.h`, `sys/mman.h`, `unistd.h`.
- Detected declarations: `function test_arena_direct_value_one_past_end`, `function test_arena_direct_value`.
- 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.