tools/testing/selftests/bpf/progs/stack_arg_fail.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/stack_arg_fail.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/stack_arg_fail.c- Extension
.c- Size
- 2180 bytes
- Lines
- 115
- 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
vmlinux.hbpf/bpf_helpers.h../test_kmods/bpf_testmod_kfunc.hbpf_misc.h
Detected Declarations
function __msgfunction __msgfunction __msgfunction __msgfunction __msgfunction __msgfunction __msgfunction __msgfunction test_stack_arg_big
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2026 Meta Platforms, Inc. and affiliates. */
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include "../test_kmods/bpf_testmod_kfunc.h"
#include "bpf_misc.h"
#if defined(__BPF_FEATURE_STACK_ARGUMENT)
SEC("tc")
__failure __msg("Unrecognized *(R11-8) type STRUCT")
int test_stack_arg_big(struct __sk_buff *skb)
{
struct prog_test_big_arg s = { .a = 1, .b = 2 };
return bpf_kfunc_call_stack_arg_big(1, 2, 3, 4, 5, s);
}
SEC("socket")
__description("r11 in ALU instruction")
__failure __msg("R11 is invalid")
__naked void r11_alu_reject(void)
{
asm volatile (
"r11 += 1;"
"r0 = 0;"
"exit;"
::: __clobber_all);
}
SEC("socket")
__description("r11 store with non-DW size")
__failure __msg("R11 is invalid")
__naked void r11_store_non_dw(void)
{
asm volatile (
"*(u32 *)(r11 - 8) = r1;"
"r0 = 0;"
"exit;"
::: __clobber_all);
}
SEC("socket")
__description("r11 store with unaligned offset")
__failure __msg("R11 is invalid")
__naked void r11_store_unaligned(void)
{
asm volatile (
"*(u64 *)(r11 - 4) = r1;"
"r0 = 0;"
"exit;"
::: __clobber_all);
}
SEC("socket")
__description("r11 store with positive offset")
__failure __msg("R11 is invalid")
__naked void r11_store_positive_off(void)
{
asm volatile (
"*(u64 *)(r11 + 8) = r1;"
"r0 = 0;"
"exit;"
::: __clobber_all);
}
SEC("socket")
__description("r11 load with negative offset")
__failure __msg("R11 is invalid")
__naked void r11_load_negative_off(void)
{
asm volatile (
"r0 = *(u64 *)(r11 - 8);"
"exit;"
::: __clobber_all);
}
SEC("socket")
__description("r11 load with non-DW size")
__failure __msg("R11 is invalid")
__naked void r11_load_non_dw(void)
{
asm volatile (
"r0 = *(u32 *)(r11 + 8);"
"exit;"
::: __clobber_all);
}
SEC("socket")
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `../test_kmods/bpf_testmod_kfunc.h`, `bpf_misc.h`.
- Detected declarations: `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function __msg`, `function test_stack_arg_big`.
- 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.