arch/x86/kernel/kprobes/ftrace.c
Source file repositories/reference/linux-study-clean/arch/x86/kernel/kprobes/ftrace.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kernel/kprobes/ftrace.c- Extension
.c- Size
- 1967 bytes
- Lines
- 77
- Domain
- Architecture Layer
- Bucket
- arch/x86
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kprobes.hlinux/ptrace.hlinux/hardirq.hlinux/preempt.hlinux/ftrace.hasm/text-patching.hcommon.h
Detected Declarations
function Copyrightfunction arch_prepare_kprobe_ftrace
Annotated Snippet
if (!p->pre_handler || !p->pre_handler(p, regs)) {
if (unlikely(p->post_handler)) {
/*
* Emulate singlestep (and also recover regs->ip)
* as if there is a 5byte nop
*/
instruction_pointer_set(regs, ip + MCOUNT_INSN_SIZE);
kcb->kprobe_status = KPROBE_HIT_SSDONE;
p->post_handler(p, regs, 0);
}
/* Recover IP address */
instruction_pointer_set(regs, orig_ip);
}
/*
* If pre_handler returns !0, it changes regs->ip. We have to
* skip emulating post_handler.
*/
__this_cpu_write(current_kprobe, NULL);
}
out:
ftrace_test_recursion_unlock(bit);
}
NOKPROBE_SYMBOL(kprobe_ftrace_handler);
int arch_prepare_kprobe_ftrace(struct kprobe *p)
{
p->ainsn.insn = NULL;
p->ainsn.boostable = false;
return 0;
}
Annotation
- Immediate include surface: `linux/kprobes.h`, `linux/ptrace.h`, `linux/hardirq.h`, `linux/preempt.h`, `linux/ftrace.h`, `asm/text-patching.h`, `common.h`.
- Detected declarations: `function Copyright`, `function arch_prepare_kprobe_ftrace`.
- Atlas domain: Architecture Layer / arch/x86.
- 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.