tools/testing/selftests/bpf/progs/verifier_ld_ind.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/verifier_ld_ind.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/verifier_ld_ind.c- Extension
.c- Size
- 5173 bytes
- Lines
- 253
- 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
linux/bpf.hbpf/bpf_helpers.h../../../include/linux/filter.hbpf_misc.h
Detected Declarations
function __msgfunction __msgfunction __msgfunction __msgfunction __msgfunction __retvalfunction bpf_gen_ld_absfunction ldind_subprogfunction __msgfunction __msgfunction ld_abs_subprog_both_paths_safefunction ld_ind_subprog_both_paths_safefunction ldabs_void_subprogfunction __msgfunction ldind_void_subprogfunction __msg
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Converted from tools/testing/selftests/bpf/verifier/ld_ind.c */
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include "../../../include/linux/filter.h"
#include "bpf_misc.h"
SEC("socket")
__description("ld_ind: check calling conv, r1")
__failure __msg("R1 !read_ok")
__failure_unpriv
__naked void ind_check_calling_conv_r1(void)
{
asm volatile (" \
r6 = r1; \
r1 = 1; \
.8byte %[ld_ind]; \
r0 = r1; \
exit; \
" :
: __imm_insn(ld_ind, BPF_LD_IND(BPF_W, BPF_REG_1, -0x200000))
: __clobber_all);
}
SEC("socket")
__description("ld_ind: check calling conv, r2")
__failure __msg("R2 !read_ok")
__failure_unpriv
__naked void ind_check_calling_conv_r2(void)
{
asm volatile (" \
r6 = r1; \
r2 = 1; \
.8byte %[ld_ind]; \
r0 = r2; \
exit; \
" :
: __imm_insn(ld_ind, BPF_LD_IND(BPF_W, BPF_REG_2, -0x200000))
: __clobber_all);
}
SEC("socket")
__description("ld_ind: check calling conv, r3")
__failure __msg("R3 !read_ok")
__failure_unpriv
__naked void ind_check_calling_conv_r3(void)
{
asm volatile (" \
r6 = r1; \
r3 = 1; \
.8byte %[ld_ind]; \
r0 = r3; \
exit; \
" :
: __imm_insn(ld_ind, BPF_LD_IND(BPF_W, BPF_REG_3, -0x200000))
: __clobber_all);
}
SEC("socket")
__description("ld_ind: check calling conv, r4")
__failure __msg("R4 !read_ok")
__failure_unpriv
__naked void ind_check_calling_conv_r4(void)
{
asm volatile (" \
r6 = r1; \
r4 = 1; \
.8byte %[ld_ind]; \
r0 = r4; \
exit; \
" :
: __imm_insn(ld_ind, BPF_LD_IND(BPF_W, BPF_REG_4, -0x200000))
: __clobber_all);
}
SEC("socket")
__description("ld_ind: check calling conv, r5")
__failure __msg("R5 !read_ok")
__failure_unpriv
__naked void ind_check_calling_conv_r5(void)
{
asm volatile (" \
r6 = r1; \
r5 = 1; \
.8byte %[ld_ind]; \
r0 = r5; \
exit; \
" :
: __imm_insn(ld_ind, BPF_LD_IND(BPF_W, BPF_REG_5, -0x200000))
Annotation
- Immediate include surface: `linux/bpf.h`, `bpf/bpf_helpers.h`, `../../../include/linux/filter.h`, `bpf_misc.h`.
- Detected declarations: `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __retval`, `function bpf_gen_ld_abs`, `function ldind_subprog`, `function __msg`, `function __msg`.
- 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.