Re: [for-next][PATCH 12/16] kprobes: Initialize kprobes at postcore_initcall
From: Steven Rostedt
Date: Wed Jul 03 2019 - 10:37:20 EST
This would be the official patch:
From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>
Subject: [PATCH] kprobes: Run init_test_probes() later in boot up
It was reported that the moving of the kprobe initialization earlier in the
boot process caused arm64 to crash. This was due to arm64 depending on the
BRK handler being registered first, but the init_test_probes() can be called
before that happens.
By moving the init_test_probes() to later in the boot process, the BRK
handler is now guaranteed to be initialized before init_test_probes() is
called.
Link: http://lkml.kernel.org/r/20190702165008.GC34718@xxxxxxxxxxxxxxxxxxxxxxxxx
Tested-by: Catalin Marinas <catalin.marinas@xxxxxxx>
Reported-by: Mark Rutland <mark.rutland@xxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
kernel/kprobes.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 5471efbeb937..5a6ecd7bfd73 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2235,6 +2235,8 @@ static struct notifier_block kprobe_module_nb = {
extern unsigned long __start_kprobe_blacklist[];
extern unsigned long __stop_kprobe_blacklist[];
+static bool run_kprobe_tests __initdata;
+
static int __init init_kprobes(void)
{
int i, err = 0;
@@ -2286,11 +2288,19 @@ static int __init init_kprobes(void)
kprobes_initialized = (err == 0);
if (!err)
- init_test_probes();
+ run_kprobe_tests = true;
return err;
}
subsys_initcall(init_kprobes);
+static int __init run_init_test_probes(void)
+{
+ if (run_kprobe_tests)
+ init_test_probes();
+ return 0;
+}
+module_init(run_init_test_probes);
+
#ifdef CONFIG_DEBUG_FS
static void report_probe(struct seq_file *pi, struct kprobe *p,
const char *sym, int offset, char *modname, struct kprobe *pp)
--
2.20.1