tools/testing/selftests/bpf/progs/tracing_multi_check.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/tracing_multi_check.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/tracing_multi_check.c- Extension
.c- Size
- 5567 bytes
- Lines
- 215
- 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
vmlinux.hbpf/bpf_helpers.hbpf/bpf_tracing.h
Detected Declarations
function tracing_multi_arg_check
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
#include <vmlinux.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL";
int pid = 0;
bool test_cookies = false;
/* bpf_fentry_test1 is exported as kfunc via vmlinux.h */
extern const void bpf_fentry_test2 __ksym;
extern const void bpf_fentry_test3 __ksym;
extern const void bpf_fentry_test4 __ksym;
extern const void bpf_fentry_test5 __ksym;
extern const void bpf_fentry_test6 __ksym;
extern const void bpf_fentry_test7 __ksym;
extern const void bpf_fentry_test8 __ksym;
extern const void bpf_fentry_test9 __ksym;
extern const void bpf_fentry_test10 __ksym;
extern const void bpf_testmod_fentry_test1 __ksym;
extern const void bpf_testmod_fentry_test2 __ksym;
extern const void bpf_testmod_fentry_test3 __ksym;
extern const void bpf_testmod_fentry_test7 __ksym;
extern const void bpf_testmod_fentry_test11 __ksym;
int tracing_multi_arg_check(__u64 *ctx, __u64 *test_result, bool is_return)
{
void *ip = (void *) bpf_get_func_ip(ctx);
__u64 value = 0, ret = 0, cookie = 0;
long err = 0;
if (bpf_get_current_pid_tgid() >> 32 != pid)
return 1;
if (is_return)
err |= bpf_get_func_ret(ctx, &ret);
if (test_cookies)
cookie = bpf_get_attach_cookie(ctx);
if (ip == &bpf_fentry_test1) {
int a;
err |= bpf_get_func_arg(ctx, 0, &value);
a = (int) value;
err |= is_return ? ret != 2 : 0;
err |= test_cookies ? cookie != 8 : 0;
*test_result += err == 0 && a == 1;
} else if (ip == &bpf_fentry_test2) {
__u64 b;
int a;
err |= bpf_get_func_arg(ctx, 0, &value);
a = (int) value;
err |= bpf_get_func_arg(ctx, 1, &value);
b = value;
err |= is_return ? ret != 5 : 0;
err |= test_cookies ? cookie != 9 : 0;
*test_result += err == 0 && a == 2 && b == 3;
} else if (ip == &bpf_fentry_test3) {
__u64 c;
char a;
int b;
err |= bpf_get_func_arg(ctx, 0, &value);
a = (char) value;
err |= bpf_get_func_arg(ctx, 1, &value);
b = (int) value;
err |= bpf_get_func_arg(ctx, 2, &value);
c = value;
err |= is_return ? ret != 15 : 0;
err |= test_cookies ? cookie != 7 : 0;
*test_result += err == 0 && a == 4 && b == 5 && c == 6;
} else if (ip == &bpf_fentry_test4) {
void *a;
char b;
int c;
__u64 d;
err |= bpf_get_func_arg(ctx, 0, &value);
a = (void *) value;
err |= bpf_get_func_arg(ctx, 1, &value);
b = (char) value;
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `bpf/bpf_tracing.h`.
- Detected declarations: `function tracing_multi_arg_check`.
- 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.