diff options
-rw-r--r-- | arch/x86/kernel/kprobes/core.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index 1deffe6cc873..5b187dfbfc8b 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c | |||
@@ -671,38 +671,37 @@ NOKPROBE_SYMBOL(kprobe_int3_handler); | |||
671 | * When a retprobed function returns, this code saves registers and | 671 | * When a retprobed function returns, this code saves registers and |
672 | * calls trampoline_handler() runs, which calls the kretprobe's handler. | 672 | * calls trampoline_handler() runs, which calls the kretprobe's handler. |
673 | */ | 673 | */ |
674 | static void __used kretprobe_trampoline_holder(void) | 674 | asm( |
675 | { | 675 | ".global kretprobe_trampoline\n" |
676 | asm volatile ( | 676 | ".type kretprobe_trampoline, @function\n" |
677 | ".global kretprobe_trampoline\n" | 677 | "kretprobe_trampoline:\n" |
678 | "kretprobe_trampoline: \n" | ||
679 | #ifdef CONFIG_X86_64 | 678 | #ifdef CONFIG_X86_64 |
680 | /* We don't bother saving the ss register */ | 679 | /* We don't bother saving the ss register */ |
681 | " pushq %rsp\n" | 680 | " pushq %rsp\n" |
682 | " pushfq\n" | 681 | " pushfq\n" |
683 | SAVE_REGS_STRING | 682 | SAVE_REGS_STRING |
684 | " movq %rsp, %rdi\n" | 683 | " movq %rsp, %rdi\n" |
685 | " call trampoline_handler\n" | 684 | " call trampoline_handler\n" |
686 | /* Replace saved sp with true return address. */ | 685 | /* Replace saved sp with true return address. */ |
687 | " movq %rax, 152(%rsp)\n" | 686 | " movq %rax, 152(%rsp)\n" |
688 | RESTORE_REGS_STRING | 687 | RESTORE_REGS_STRING |
689 | " popfq\n" | 688 | " popfq\n" |
690 | #else | 689 | #else |
691 | " pushf\n" | 690 | " pushf\n" |
692 | SAVE_REGS_STRING | 691 | SAVE_REGS_STRING |
693 | " movl %esp, %eax\n" | 692 | " movl %esp, %eax\n" |
694 | " call trampoline_handler\n" | 693 | " call trampoline_handler\n" |
695 | /* Move flags to cs */ | 694 | /* Move flags to cs */ |
696 | " movl 56(%esp), %edx\n" | 695 | " movl 56(%esp), %edx\n" |
697 | " movl %edx, 52(%esp)\n" | 696 | " movl %edx, 52(%esp)\n" |
698 | /* Replace saved flags with true return address. */ | 697 | /* Replace saved flags with true return address. */ |
699 | " movl %eax, 56(%esp)\n" | 698 | " movl %eax, 56(%esp)\n" |
700 | RESTORE_REGS_STRING | 699 | RESTORE_REGS_STRING |
701 | " popf\n" | 700 | " popf\n" |
702 | #endif | 701 | #endif |
703 | " ret\n"); | 702 | " ret\n" |
704 | } | 703 | ".size kretprobe_trampoline, .-kretprobe_trampoline\n" |
705 | NOKPROBE_SYMBOL(kretprobe_trampoline_holder); | 704 | ); |
706 | NOKPROBE_SYMBOL(kretprobe_trampoline); | 705 | NOKPROBE_SYMBOL(kretprobe_trampoline); |
707 | 706 | ||
708 | /* | 707 | /* |