tools/testing/selftests/bpf/progs/linked_list_fail.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/linked_list_fail.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/linked_list_fail.c- Extension
.c- Size
- 13139 bytes
- Lines
- 612
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_tracing.hbpf/bpf_helpers.hbpf/bpf_core_read.hbpf_experimental.hlinked_list.h
Detected Declarations
struct test1struct test2function map_compat_kprobefunction map_compat_kretprobefunction map_compat_tpfunction map_compat_perffunction map_compat_raw_tpfunction map_compat_raw_tp_wfunction obj_type_id_oorfunction obj_new_no_compositefunction obj_new_no_structfunction obj_drop_non_zero_offfunction new_null_retfunction obj_new_acqfunction use_after_dropfunction ptr_walk_scalarfunction direct_read_lockfunction direct_write_lockfunction direct_read_headfunction direct_write_headfunction direct_read_nodefunction direct_write_nodefunction use_after_unlockfunction use_after_unlock_push_frontfunction use_after_unlock_push_backfunction list_double_addfunction double_push_frontfunction double_push_backfunction no_node_value_typefunction incorrect_value_typefunction incorrect_node_var_offfunction incorrect_node_off1function incorrect_node_off2function no_head_typefunction incorrect_head_var_off1function incorrect_head_var_off2function incorrect_head_off1function incorrect_head_off2function pop_ptr_offfunction pop_front_offfunction pop_back_off
Annotated Snippet
struct test1 {
struct test2 {
struct test2 *next;
} *ptr;
} *p;
p = bpf_obj_new(typeof(*p));
if (!p)
return 0;
bpf_this_cpu_ptr(p->ptr);
return 0;
}
SEC("?tc")
int direct_read_lock(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
return *(int *)&f->lock;
}
SEC("?tc")
int direct_write_lock(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
*(int *)&f->lock = 0;
return 0;
}
SEC("?tc")
int direct_read_head(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
return *(int *)&f->head;
}
SEC("?tc")
int direct_write_head(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
*(int *)&f->head = 0;
return 0;
}
SEC("?tc")
int direct_read_node(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
return *(int *)&f->node2;
}
SEC("?tc")
int direct_write_node(void *ctx)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
*(int *)&f->node2 = 0;
return 0;
}
static __always_inline
int use_after_unlock(bool push_front)
{
struct foo *f;
f = bpf_obj_new(typeof(*f));
if (!f)
return 0;
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_tracing.h`, `bpf/bpf_helpers.h`, `bpf/bpf_core_read.h`, `bpf_experimental.h`, `linked_list.h`.
- Detected declarations: `struct test1`, `struct test2`, `function map_compat_kprobe`, `function map_compat_kretprobe`, `function map_compat_tp`, `function map_compat_perf`, `function map_compat_raw_tp`, `function map_compat_raw_tp_w`, `function obj_type_id_oor`, `function obj_new_no_composite`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.