Skip to content

Commit

Permalink
kprobes: Fix to init kprobes in subsys_initcall
Browse files Browse the repository at this point in the history
Since arm64 kernel initializes breakpoint trap vector in arch_initcall(),
initializing kprobe (and run smoke test) in postcore_initcall() causes
a kernel panic.

To fix this issue, move the kprobe initialization in subsys_initcall()
(which is called right afer the arch_initcall).

In-kernel kprobe users (ftrace and bpf) are using fs_initcall() which is
called after subsys_initcall(), so this shouldn't cause more problem.

Link: http://lkml.kernel.org/r/155956708268.12228.10363800793132214198.stgit@devnote2
Link: http://lkml.kernel.org/r/[email protected]

Reported-by: Anders Roxell <[email protected]>
Fixes: b5f8b32 ("kprobes: Initialize kprobes at postcore_initcall")
Tested-by: Anders Roxell <[email protected]>
Tested-by: Mark Rutland <[email protected]>
Signed-off-by: Masami Hiramatsu <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
mhiramat authored and rostedt committed Jul 16, 2019
1 parent f0553dc commit 65fc965
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -2289,7 +2289,7 @@ static int __init init_kprobes(void)
init_test_probes();
return err;
}
postcore_initcall(init_kprobes);
subsys_initcall(init_kprobes);

#ifdef CONFIG_DEBUG_FS
static void report_probe(struct seq_file *pi, struct kprobe *p,
Expand Down

0 comments on commit 65fc965

Please sign in to comment.