diff options
-rw-r--r-- | arch/x86/kernel/uprobes.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index b3c2a92cce6c..2efb93f96030 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c | |||
@@ -759,22 +759,24 @@ int arch_uprobe_post_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | |||
759 | struct uprobe_task *utask = current->utask; | 759 | struct uprobe_task *utask = current->utask; |
760 | 760 | ||
761 | WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR); | 761 | WARN_ON_ONCE(current->thread.trap_nr != UPROBE_TRAP_NR); |
762 | current->thread.trap_nr = utask->autask.saved_trap_nr; | ||
762 | 763 | ||
763 | if (auprobe->ops->post_xol) { | 764 | if (auprobe->ops->post_xol) { |
764 | int err = auprobe->ops->post_xol(auprobe, regs); | 765 | int err = auprobe->ops->post_xol(auprobe, regs); |
765 | if (err) { | 766 | if (err) { |
766 | arch_uprobe_abort_xol(auprobe, regs); | 767 | if (!utask->autask.saved_tf) |
768 | regs->flags &= ~X86_EFLAGS_TF; | ||
767 | /* | 769 | /* |
768 | * Restart the probed insn. ->post_xol() must ensure | 770 | * Restore ->ip for restart or post mortem analysis. |
769 | * this is really possible if it returns -ERESTART. | 771 | * ->post_xol() must not return -ERESTART unless this |
772 | * is really possible. | ||
770 | */ | 773 | */ |
774 | regs->ip = utask->vaddr; | ||
771 | if (err == -ERESTART) | 775 | if (err == -ERESTART) |
772 | return 0; | 776 | return 0; |
773 | return err; | 777 | return err; |
774 | } | 778 | } |
775 | } | 779 | } |
776 | |||
777 | current->thread.trap_nr = utask->autask.saved_trap_nr; | ||
778 | /* | 780 | /* |
779 | * arch_uprobe_pre_xol() doesn't save the state of TIF_BLOCKSTEP | 781 | * arch_uprobe_pre_xol() doesn't save the state of TIF_BLOCKSTEP |
780 | * so we can get an extra SIGTRAP if we do not clear TF. We need | 782 | * so we can get an extra SIGTRAP if we do not clear TF. We need |
@@ -819,9 +821,8 @@ int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, | |||
819 | 821 | ||
820 | /* | 822 | /* |
821 | * This function gets called when XOL instruction either gets trapped or | 823 | * This function gets called when XOL instruction either gets trapped or |
822 | * the thread has a fatal signal, or if arch_uprobe_post_xol() failed. | 824 | * the thread has a fatal signal. Reset the instruction pointer to its |
823 | * Reset the instruction pointer to its probed address for the potential | 825 | * probed address for the potential restart or for post mortem analysis. |
824 | * restart or for post mortem analysis. | ||
825 | */ | 826 | */ |
826 | void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) | 827 | void arch_uprobe_abort_xol(struct arch_uprobe *auprobe, struct pt_regs *regs) |
827 | { | 828 | { |