include/linux/kprobes.h
Source file repositories/reference/linux-study-clean/include/linux/kprobes.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/kprobes.h- Extension
.h- Size
- 16642 bytes
- Lines
- 595
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.hlinux/linkage.hlinux/list.hlinux/notifier.hlinux/smp.hlinux/bug.hlinux/percpu.hlinux/spinlock.hlinux/rcupdate.hlinux/mutex.hlinux/ftrace.hlinux/objpool.hlinux/rethook.hasm/kprobes.hasm-generic/kprobes.h
Detected Declarations
struct arch_specific_insnstruct kprobestruct pt_regsstruct kretprobestruct kretprobe_instancestruct kprobestruct kretprobe_holderstruct kretprobestruct kretprobe_instancestruct kretprobe_blackpointstruct kprobe_blacklist_entrystruct kprobe_insn_cachestruct optimized_kprobefunction kprobe_gonefunction kprobe_disabledfunction kprobe_optimizedfunction kprobe_ftracefunction get_kretprobe_retaddrfunction dereference_function_descriptorfunction kretprobe_trampoline_handlerfunction get_kretprobe_retaddrfunction arch_prepare_kretprobefunction wait_for_kprobe_optimizerfunction arch_prepare_kprobe_ftracefunction kprobe_ftrace_killfunction reset_current_kprobefunction kprobe_fault_handlerfunction register_kprobefunction register_kprobesfunction unregister_kprobefunction register_kretprobesfunction unregister_kretprobefunction enable_kprobefunction within_kprobe_blacklistfunction kprobe_get_kallsymfunction disable_kretprobefunction enable_kretprobefunction is_kprobe_insn_slotfunction is_kprobe_optinsn_slotfunction is_kretprobe_trampolinefunction kretprobe_find_ret_addrfunction is_kretprobe_trampolinefunction is_kretprobe_trampolinefunction kretprobe_find_ret_addrfunction kprobe_page_fault
Annotated Snippet
struct arch_specific_insn {
int dummy;
};
#endif /* CONFIG_KPROBES */
struct kprobe;
struct pt_regs;
struct kretprobe;
struct kretprobe_instance;
typedef int (*kprobe_pre_handler_t) (struct kprobe *, struct pt_regs *);
typedef void (*kprobe_post_handler_t) (struct kprobe *, struct pt_regs *,
unsigned long flags);
typedef int (*kretprobe_handler_t) (struct kretprobe_instance *,
struct pt_regs *);
struct kprobe {
struct hlist_node hlist;
/* list of kprobes for multi-handler support */
struct list_head list;
/*count the number of times this probe was temporarily disarmed */
unsigned long nmissed;
/* location of the probe point */
kprobe_opcode_t *addr;
/* Allow user to indicate symbol name of the probe point */
const char *symbol_name;
/* Offset into the symbol */
unsigned int offset;
/* Called before addr is executed. */
kprobe_pre_handler_t pre_handler;
/* Called after addr is executed, unless... */
kprobe_post_handler_t post_handler;
/* Saved opcode (which has been replaced with breakpoint) */
kprobe_opcode_t opcode;
/* copy of the original instruction */
struct arch_specific_insn ainsn;
/*
* Indicates various status flags.
* Protected by kprobe_mutex after this kprobe is registered.
*/
u32 flags;
};
/* Kprobe status flags */
#define KPROBE_FLAG_GONE 1 /* breakpoint has already gone */
#define KPROBE_FLAG_DISABLED 2 /* probe is temporarily disabled */
#define KPROBE_FLAG_OPTIMIZED 4 /*
* probe is really optimized.
* NOTE:
* this flag is only for optimized_kprobe.
*/
#define KPROBE_FLAG_FTRACE 8 /* probe is using ftrace */
#define KPROBE_FLAG_ON_FUNC_ENTRY 16 /* probe is on the function entry */
/* Has this kprobe gone ? */
static inline bool kprobe_gone(struct kprobe *p)
{
return p->flags & KPROBE_FLAG_GONE;
}
/* Is this kprobe disabled ? */
static inline bool kprobe_disabled(struct kprobe *p)
{
return p->flags & (KPROBE_FLAG_DISABLED | KPROBE_FLAG_GONE);
}
/* Is this kprobe really running optimized path ? */
static inline bool kprobe_optimized(struct kprobe *p)
{
return p->flags & KPROBE_FLAG_OPTIMIZED;
}
/* Is this kprobe uses ftrace ? */
static inline bool kprobe_ftrace(struct kprobe *p)
{
return p->flags & KPROBE_FLAG_FTRACE;
}
/*
* Function-return probe -
* Note:
Annotation
- Immediate include surface: `linux/compiler.h`, `linux/linkage.h`, `linux/list.h`, `linux/notifier.h`, `linux/smp.h`, `linux/bug.h`, `linux/percpu.h`, `linux/spinlock.h`.
- Detected declarations: `struct arch_specific_insn`, `struct kprobe`, `struct pt_regs`, `struct kretprobe`, `struct kretprobe_instance`, `struct kprobe`, `struct kretprobe_holder`, `struct kretprobe`, `struct kretprobe_instance`, `struct kretprobe_blackpoint`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.