mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-16 06:31:46 +00:00
x86/kprobes: Get rid of kretprobe_trampoline_holder()
The kretprobe_trampoline_holder() wrapper around kretprobe_trampoline() isn't used anywhere and adds some unnecessary frame pointer instructions which never execute. Instead, just make kretprobe_trampoline() a proper ELF function. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Andy Lutomirski <luto@kernel.org> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Chris J Arges <chris.j.arges@canonical.com> Cc: David S. Miller <davem@davemloft.net> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michal Marek <mmarek@suse.cz> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Pedro Alves <palves@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Link: http://lkml.kernel.org/r/92d921b102fb865a7c254cfde9e4a0a72b9a781e.1453405861.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
d21001cc15
commit
c1c355ce14
@ -671,38 +671,37 @@ NOKPROBE_SYMBOL(kprobe_int3_handler);
|
|||||||
* When a retprobed function returns, this code saves registers and
|
* When a retprobed function returns, this code saves registers and
|
||||||
* calls trampoline_handler() runs, which calls the kretprobe's handler.
|
* calls trampoline_handler() runs, which calls the kretprobe's handler.
|
||||||
*/
|
*/
|
||||||
static void __used kretprobe_trampoline_holder(void)
|
asm(
|
||||||
{
|
".global kretprobe_trampoline\n"
|
||||||
asm volatile (
|
".type kretprobe_trampoline, @function\n"
|
||||||
".global kretprobe_trampoline\n"
|
"kretprobe_trampoline:\n"
|
||||||
"kretprobe_trampoline: \n"
|
|
||||||
#ifdef CONFIG_X86_64
|
#ifdef CONFIG_X86_64
|
||||||
/* We don't bother saving the ss register */
|
/* We don't bother saving the ss register */
|
||||||
" pushq %rsp\n"
|
" pushq %rsp\n"
|
||||||
" pushfq\n"
|
" pushfq\n"
|
||||||
SAVE_REGS_STRING
|
SAVE_REGS_STRING
|
||||||
" movq %rsp, %rdi\n"
|
" movq %rsp, %rdi\n"
|
||||||
" call trampoline_handler\n"
|
" call trampoline_handler\n"
|
||||||
/* Replace saved sp with true return address. */
|
/* Replace saved sp with true return address. */
|
||||||
" movq %rax, 152(%rsp)\n"
|
" movq %rax, 152(%rsp)\n"
|
||||||
RESTORE_REGS_STRING
|
RESTORE_REGS_STRING
|
||||||
" popfq\n"
|
" popfq\n"
|
||||||
#else
|
#else
|
||||||
" pushf\n"
|
" pushf\n"
|
||||||
SAVE_REGS_STRING
|
SAVE_REGS_STRING
|
||||||
" movl %esp, %eax\n"
|
" movl %esp, %eax\n"
|
||||||
" call trampoline_handler\n"
|
" call trampoline_handler\n"
|
||||||
/* Move flags to cs */
|
/* Move flags to cs */
|
||||||
" movl 56(%esp), %edx\n"
|
" movl 56(%esp), %edx\n"
|
||||||
" movl %edx, 52(%esp)\n"
|
" movl %edx, 52(%esp)\n"
|
||||||
/* Replace saved flags with true return address. */
|
/* Replace saved flags with true return address. */
|
||||||
" movl %eax, 56(%esp)\n"
|
" movl %eax, 56(%esp)\n"
|
||||||
RESTORE_REGS_STRING
|
RESTORE_REGS_STRING
|
||||||
" popf\n"
|
" popf\n"
|
||||||
#endif
|
#endif
|
||||||
" ret\n");
|
" ret\n"
|
||||||
}
|
".size kretprobe_trampoline, .-kretprobe_trampoline\n"
|
||||||
NOKPROBE_SYMBOL(kretprobe_trampoline_holder);
|
);
|
||||||
NOKPROBE_SYMBOL(kretprobe_trampoline);
|
NOKPROBE_SYMBOL(kretprobe_trampoline);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user