]> git.baikalelectronics.ru Git - kernel.git/commit
x86/kprobes: Fix a bug which can modify kernel code permanently
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Mon, 5 Mar 2012 13:32:16 +0000 (22:32 +0900)
committerIngo Molnar <mingo@elte.hu>
Tue, 6 Mar 2012 08:49:49 +0000 (09:49 +0100)
commit00b76a0eb995b28655628e7ecd9de6a751009f40
treefdf0b98237845a7d9af8a01cdf4971b43a2a3063
parentdb081ed9c6438ffbc4fb27c48ae02e3f1cd36ea8
x86/kprobes: Fix a bug which can modify kernel code permanently

Fix a bug in kprobes which can modify kernel code
permanently at run-time. In the result, kernel can
crash when it executes the modified code.

This bug can happen when we put two probes enough near
and the first probe is optimized. When the second probe
is set up, it copies a byte which is already modified
by the first probe, and executes it when the probe is hit.
Even worse, the first probe and the second probe are removed
respectively, the second probe writes back the copied
(modified) instruction.

To fix this bug, kprobes always recovers the original
code and copies the first byte from recovered instruction.

Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: yrl.pp-manager.tt@hitachi.com
Cc: systemtap@sourceware.org
Cc: anderson@redhat.com
Link: http://lkml.kernel.org/r/20120305133215.5982.31991.stgit@localhost.localdomain
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/kprobes.c