aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/kprobes.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2020-11-07 13:18:49 +0100
committerIngo Molnar <mingo@kernel.org>2020-11-07 13:18:49 +0100
commit0a986ea81e1aa8ac17e82cda53cc95158217956e (patch)
treea054b0ef413b7f327c04137c5768b2da6488511d /kernel/kprobes.c
parentkprobes: Replace rp->free_instance with freelist (diff)
parentkprobes: Init kprobes in early_initcall (diff)
downloadlinux-dev-0a986ea81e1aa8ac17e82cda53cc95158217956e.tar.xz
linux-dev-0a986ea81e1aa8ac17e82cda53cc95158217956e.zip
Merge branch 'linus' into perf/kprobes
Merge recent kprobes updates into perf/kprobes that came from -mm. Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r--kernel/kprobes.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 30b8fe7d571d..f7fb5d135930 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2428,6 +2428,28 @@ static struct notifier_block kprobe_module_nb = {
extern unsigned long __start_kprobe_blacklist[];
extern unsigned long __stop_kprobe_blacklist[];
+void kprobe_free_init_mem(void)
+{
+ void *start = (void *)(&__init_begin);
+ void *end = (void *)(&__init_end);
+ struct hlist_head *head;
+ struct kprobe *p;
+ int i;
+
+ mutex_lock(&kprobe_mutex);
+
+ /* Kill all kprobes on initmem */
+ for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
+ head = &kprobe_table[i];
+ hlist_for_each_entry(p, head, hlist) {
+ if (start <= (void *)p->addr && (void *)p->addr < end)
+ kill_kprobe(p);
+ }
+ }
+
+ mutex_unlock(&kprobe_mutex);
+}
+
static int __init init_kprobes(void)
{
int i, err = 0;
@@ -2479,7 +2501,7 @@ static int __init init_kprobes(void)
init_test_probes();
return err;
}
-subsys_initcall(init_kprobes);
+early_initcall(init_kprobes);
#ifdef CONFIG_DEBUG_FS
static void report_probe(struct seq_file *pi, struct kprobe *p,