]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Improve kprobes test for atomic sequence
authorDavid A. Long <dave.long@linaro.org>
Mon, 12 Sep 2016 18:21:27 +0000 (14:21 -0400)
committerWill Deacon <will.deacon@arm.com>
Thu, 15 Sep 2016 07:33:46 +0000 (08:33 +0100)
commit594daff46e2306b6a7c3ae6490705869ac281e1c
treeb7720aa433293cdefb7bd457512a7c6a51e0e105
parent592379f2050eb1c3f5f2a35eecdc2139abbf2268
arm64: Improve kprobes test for atomic sequence

Kprobes searches backwards a finite number of instructions to determine if
there is an attempt to probe a load/store exclusive sequence. It stops when
it hits the maximum number of instructions or a load or store exclusive.
However this means it can run up past the beginning of the function and
start looking at literal constants. This has been shown to cause a false
positive and blocks insertion of the probe. To fix this, further limit the
backwards search to stop if it hits a symbol address from kallsyms. The
presumption is that this is the entry point to this code (particularly for
the common case of placing probes at the beginning of functions).

This also improves efficiency by not searching code that is not part of the
function. There may be some possibility that the label might not denote the
entry path to the probed instruction but the likelihood seems low and this
is just another example of how the kprobes user really needs to be
careful about what they are doing.

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: David A. Long <dave.long@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/probes/decode-insn.c