kernel/kprobes.c
Source file repositories/reference/linux-study-clean/kernel/kprobes.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/kprobes.c- Extension
.c- Size
- 77423 bytes
- Lines
- 3076
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kprobes.hlinux/hash.hlinux/init.hlinux/slab.hlinux/stddef.hlinux/export.hlinux/kallsyms.hlinux/freezer.hlinux/seq_file.hlinux/debugfs.hlinux/sysctl.hlinux/kdebug.hlinux/kthread.hlinux/memory.hlinux/ftrace.hlinux/cpu.hlinux/jump_label.hlinux/static_call.hlinux/perf_event.hlinux/execmem.hlinux/cleanup.hlinux/wait.hasm/sections.hasm/cacheflush.hasm/errno.hlinux/uaccess.h
Detected Declarations
struct kprobe_insn_pageenum kprobe_slot_statefunction kprobe_lookup_namefunction slots_per_pagefunction free_insn_pagefunction list_for_each_entry_rcufunction collect_one_slotfunction collect_garbage_slotsfunction list_for_each_entry_safefunction __find_insn_pagefunction __free_insn_slotfunction __is_insn_slot_addrfunction kprobe_cache_get_kallsymfunction free_optinsn_pagefunction set_kprobe_instancefunction reset_kprobe_instancefunction lockdep_is_heldfunction kprobe_aggrprobefunction kprobe_unusedfunction copy_kprobefunction opt_pre_handlerfunction list_for_each_entry_rcufunction free_aggr_kprobefunction kprobe_optreadyfunction kprobe_disarmedfunction kprobe_queuedfunction Optimizefunction Unoptimizefunction do_free_cleaned_kprobesfunction list_for_each_entry_safefunction kprobe_optimizerfunction scoped_guardfunction kprobe_optimizer_threadfunction kick_kprobe_optimizerfunction wait_for_kprobe_optimizer_lockedfunction wait_for_kprobe_optimizerfunction optprobe_queued_unoptfunction list_for_each_entryfunction optimize_kprobefunction force_unoptimize_kprobefunction unoptimize_kprobefunction reuse_unused_kprobefunction kill_optimized_kprobefunction __prepare_optimized_kprobefunction prepare_optimized_kprobefunction try_to_optimize_kprobefunction optimize_all_kprobesfunction unoptimize_all_kprobes
Annotated Snippet
static const struct file_operations fops_kp = {
.read = read_enabled_file_bool,
.write = write_enabled_file_bool,
.llseek = default_llseek,
};
static int __init debugfs_kprobe_init(void)
{
struct dentry *dir;
dir = debugfs_create_dir("kprobes", NULL);
debugfs_create_file("list", 0400, dir, NULL, &kprobes_fops);
debugfs_create_file("enabled", 0600, dir, NULL, &fops_kp);
debugfs_create_file("blacklist", 0400, dir, NULL,
&kprobe_blacklist_fops);
return 0;
}
late_initcall(debugfs_kprobe_init);
#endif /* CONFIG_DEBUG_FS */
Annotation
- Immediate include surface: `linux/kprobes.h`, `linux/hash.h`, `linux/init.h`, `linux/slab.h`, `linux/stddef.h`, `linux/export.h`, `linux/kallsyms.h`, `linux/freezer.h`.
- Detected declarations: `struct kprobe_insn_page`, `enum kprobe_slot_state`, `function kprobe_lookup_name`, `function slots_per_page`, `function free_insn_page`, `function list_for_each_entry_rcu`, `function collect_one_slot`, `function collect_garbage_slots`, `function list_for_each_entry_safe`, `function __find_insn_page`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: pattern 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.