• David A. Long's avatar
    arm64: Improve kprobes test for atomic sequence · 3e593f66
    David A. Long authored
    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: default avatarMasami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: default avatarDavid A. Long <dave.long@linaro.org>
    Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
    3e593f66
decode-insn.c 5.23 KB