]> git.ipfire.org Git - people/arne_f/kernel.git/commit
kprobes/x86: Return correct length in __copy_instruction()
authorEugene Shatokhin <eugene.shatokhin@rosalab.ru>
Tue, 17 Mar 2015 10:09:18 +0000 (19:09 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Jul 2015 02:49:04 +0000 (19:49 -0700)
commitf3fb38ae7386eeff5913251950e285efa86a3b24
treed2cd17588645c5d3ad0d45c828f7df4ef74b7592
parent22ff38e850b7fc87bdcccbebe92c3e7764ffe389
kprobes/x86: Return correct length in __copy_instruction()

commit c80e5c0c23ce2282476fdc64c4b5e3d3a40723fd upstream.

On x86-64, __copy_instruction() always returns 0 (error) if the
instruction uses %rip-relative addressing. This is because
kernel_insn_init() is called the second time for 'insn' instance
in such cases and sets all its fields to 0.

Because of this, trying to place a kprobe on such instruction
will fail, register_kprobe() will return -EINVAL.

This patch fixes the problem.

Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/20150317100918.28349.94654.stgit@localhost.localdomain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/kprobes/core.c