]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commit
tracing/kprobes: Enforce kprobes teardown after testing
authorThomas Gleixner <tglx@linutronix.de>
Wed, 17 May 2017 08:19:49 +0000 (10:19 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Tue, 20 Jun 2017 10:18:34 +0000 (12:18 +0200)
commitae5e3f8e3162801c44bec6fc157cd08be1eb42c7
tree336455d46fe12ae7d31eea541e2a28dbe33e7168
parent058662b07e89195bf865c936f7a68c5c455583ae
tracing/kprobes: Enforce kprobes teardown after testing

BugLink: http://bugs.launchpad.net/bugs/1694621
commit 30e7d894c1478c88d50ce94ddcdbd7f9763d9cdd upstream.

Enabling the tracer selftest triggers occasionally the warning in
text_poke(), which warns when the to be modified page is not marked
reserved.

The reason is that the tracer selftest installs kprobes on functions marked
__init for testing. These probes are removed after the tests, but that
removal schedules the delayed kprobes_optimizer work, which will do the
actual text poke. If the work is executed after the init text is freed,
then the warning triggers. The bug can be reproduced reliably when the work
delay is increased.

Flush the optimizer work and wait for the optimizing/unoptimizing lists to
become empty before returning from the kprobes tracer selftest. That
ensures that all operations which were queued due to the probes removal
have completed.

Link: http://lkml.kernel.org/r/20170516094802.76a468bb@gandalf.local.home
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Fixes: 6274de498 ("kprobes: Support delayed unoptimizing")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
include/linux/kprobes.h
kernel/kprobes.c
kernel/trace/trace_kprobe.c