tools/testing/selftests/bpf/progs/uprobe_multi_session.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/bpf/progs/uprobe_multi_session.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/bpf/progs/uprobe_multi_session.c- Extension
.c- Size
- 1573 bytes
- Lines
- 71
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
vmlinux.hbpf/bpf_helpers.hbpf/bpf_tracing.hstdbool.hbpf_misc.h
Detected Declarations
function uprobe_multi_checkfunction uprobefunction verify_sleepable_user_copyfunction uprobe_sleepable
Annotated Snippet
if (funcs[i] == addr) {
uprobe_session_result[i]++;
break;
}
}
/* only uprobe_multi_func_2 executes return probe */
if ((addr == uprobe_multi_func_1_addr) ||
(addr == uprobe_multi_func_3_addr))
return 1;
return 0;
}
SEC("uprobe.session//proc/self/exe:uprobe_multi_func_*")
int uprobe(struct pt_regs *ctx)
{
return uprobe_multi_check(ctx, bpf_session_is_return(ctx));
}
static __always_inline bool verify_sleepable_user_copy(void)
{
char data[9];
bpf_copy_from_user(data, sizeof(data), user_ptr);
return bpf_strncmp(data, sizeof(data), "test_data") == 0;
}
SEC("uprobe.session.s//proc/self/exe:uprobe_multi_func_*")
int uprobe_sleepable(struct pt_regs *ctx)
{
if (verify_sleepable_user_copy())
uprobe_multi_sleep_result++;
return uprobe_multi_check(ctx, bpf_session_is_return(ctx));
}
Annotation
- Immediate include surface: `vmlinux.h`, `bpf/bpf_helpers.h`, `bpf/bpf_tracing.h`, `stdbool.h`, `bpf_misc.h`.
- Detected declarations: `function uprobe_multi_check`, `function uprobe`, `function verify_sleepable_user_copy`, `function uprobe_sleepable`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.