powerpc/kprobes: Use ftrace to determine if a probe is at function entry
authorNaveen N Rao <naveen@kernel.org>
Wed, 30 Oct 2024 07:08:35 +0000 (12:38 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 31 Oct 2024 00:00:52 +0000 (11:00 +1100)
commitbe87d713eaddf0421ccd61cc060c4c29bc36fc9b
tree7328fca22cf32ab040555d974968a79f6465f7d9
parent0b9846529e29ba988ce88b98df633de79675fcb3
powerpc/kprobes: Use ftrace to determine if a probe is at function entry

Rather than hard-coding the offset into a function to be used to
determine if a kprobe is at function entry, use ftrace_location() to
determine the ftrace location within the function and categorize all
instructions till that offset to be function entry.

For functions that cannot be traced, we fall back to using a fixed
offset of 8 (two instructions) to categorize a probe as being at
function entry for 64-bit elfv2, unless we are using pcrel.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Naveen N Rao <naveen@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://patch.msgid.link/20241030070850.1361304-3-hbathini@linux.ibm.com
arch/powerpc/kernel/kprobes.c