arch/arm64/kernel/probes/uprobes.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/probes/uprobes.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/probes/uprobes.c- Extension
.c- Size
- 5510 bytes
- Lines
- 227
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- 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
linux/highmem.hlinux/ptrace.hlinux/uprobes.hasm/cacheflush.hasm/gcs.hdecode-insn.h
Detected Declarations
function Copyrightfunction uprobe_get_swbp_addrfunction arch_uprobe_analyze_insnfunction arch_uprobe_pre_xolfunction arch_uprobe_post_xolfunction arch_uprobe_xol_was_trappedfunction arch_uprobe_skip_sstepfunction arch_uprobe_abort_xolfunction arch_uretprobe_is_alivefunction arch_uretprobe_hijack_return_addrfunction arch_uprobe_exception_notifyfunction uprobe_brk_handlerfunction uprobe_single_step_handler
Annotated Snippet
if (err) {
force_sig(SIGSEGV);
goto out;
}
/*
* If the LR and GCS return addr don't match, then some kind of PAC
* signing or control flow occurred since entering the probed function.
* Likely because the user is attempting to retprobe on an instruction
* that isn't a function boundary or inside a leaf function. Explicitly
* abort this retprobe because it will generate a GCS exception.
*/
if (gcs_ret_vaddr != orig_ret_vaddr) {
orig_ret_vaddr = -1;
goto out;
}
put_user_gcs(trampoline_vaddr, (__force unsigned long __user *)gcspr, &err);
if (err) {
force_sig(SIGSEGV);
goto out;
}
}
/* Replace the return addr with trampoline addr */
procedure_link_pointer_set(regs, trampoline_vaddr);
out:
return orig_ret_vaddr;
}
int arch_uprobe_exception_notify(struct notifier_block *self,
unsigned long val, void *data)
{
return NOTIFY_DONE;
}
int uprobe_brk_handler(struct pt_regs *regs,
unsigned long esr)
{
if (uprobe_pre_sstep_notifier(regs))
return DBG_HOOK_HANDLED;
return DBG_HOOK_ERROR;
}
int uprobe_single_step_handler(struct pt_regs *regs,
unsigned long esr)
{
struct uprobe_task *utask = current->utask;
WARN_ON(utask && (instruction_pointer(regs) != utask->xol_vaddr + 4));
if (uprobe_post_sstep_notifier(regs))
return DBG_HOOK_HANDLED;
return DBG_HOOK_ERROR;
}
Annotation
- Immediate include surface: `linux/highmem.h`, `linux/ptrace.h`, `linux/uprobes.h`, `asm/cacheflush.h`, `asm/gcs.h`, `decode-insn.h`.
- Detected declarations: `function Copyright`, `function uprobe_get_swbp_addr`, `function arch_uprobe_analyze_insn`, `function arch_uprobe_pre_xol`, `function arch_uprobe_post_xol`, `function arch_uprobe_xol_was_trapped`, `function arch_uprobe_skip_sstep`, `function arch_uprobe_abort_xol`, `function arch_uretprobe_is_alive`, `function arch_uretprobe_hijack_return_addr`.
- Atlas domain: Architecture Layer / arch/arm64.
- 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.