tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/test_uprobe_autoattach.c- Extension
.c- Size
- 2330 bytes
- Lines
- 118
- 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_core_read.hbpf/bpf_helpers.hbpf/bpf_tracing.hbpf_misc.h
Detected Declarations
function handle_uprobe_noautoattachfunction BPF_UPROBEfunction BPF_URETPROBEfunction SECfunction BPF_URETPROBE
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2022, Oracle and/or its affiliates. */
#include "vmlinux.h"
#include <bpf/bpf_core_read.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include "bpf_misc.h"
int uprobe_byname_parm1 = 0;
int uprobe_byname_ran = 0;
int uretprobe_byname_rc = 0;
int uretprobe_byname_ret = 0;
int uretprobe_byname_ran = 0;
u64 uprobe_byname2_parm1 = 0;
int uprobe_byname2_ran = 0;
u64 uretprobe_byname2_rc = 0;
int uretprobe_byname2_ran = 0;
int test_pid;
int a[8];
/* This program cannot auto-attach, but that should not stop other
* programs from attaching.
*/
SEC("uprobe")
int handle_uprobe_noautoattach(struct pt_regs *ctx)
{
return 0;
}
SEC("uprobe//proc/self/exe:autoattach_trigger_func")
int BPF_UPROBE(handle_uprobe_byname
, int arg1
, int arg2
, int arg3
#if FUNC_REG_ARG_CNT > 3
, int arg4
#endif
#if FUNC_REG_ARG_CNT > 4
, int arg5
#endif
#if FUNC_REG_ARG_CNT > 5
, int arg6
#endif
#if FUNC_REG_ARG_CNT > 6
, int arg7
#endif
#if FUNC_REG_ARG_CNT > 7
, int arg8
#endif
)
{
uprobe_byname_parm1 = PT_REGS_PARM1_CORE(ctx);
uprobe_byname_ran = 1;
a[0] = arg1;
a[1] = arg2;
a[2] = arg3;
#if FUNC_REG_ARG_CNT > 3
a[3] = arg4;
#endif
#if FUNC_REG_ARG_CNT > 4
a[4] = arg5;
#endif
#if FUNC_REG_ARG_CNT > 5
a[5] = arg6;
#endif
#if FUNC_REG_ARG_CNT > 6
a[6] = arg7;
#endif
#if FUNC_REG_ARG_CNT > 7
a[7] = arg8;
#endif
return 0;
}
SEC("uretprobe//proc/self/exe:autoattach_trigger_func")
int BPF_URETPROBE(handle_uretprobe_byname, int ret)
{
uretprobe_byname_rc = PT_REGS_RC_CORE(ctx);
uretprobe_byname_ret = ret;
uretprobe_byname_ran = 2;
return 0;
}
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_core_read.h`, `bpf/bpf_helpers.h`, `bpf/bpf_tracing.h`, `bpf_misc.h`.
- Detected declarations: `function handle_uprobe_noautoattach`, `function BPF_UPROBE`, `function BPF_URETPROBE`, `function SEC`, `function BPF_URETPROBE`.
- 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.