Commit 4724e3e8 authored by Peter Beutner's avatar Peter Beutner Committed by Linus Torvalds

[PATCH] x86_64: fix single step handling for 32bit processes

Be more careful with TF handling to fix some copy protection codes in wine

patch originally for i386 by Linus, then ported to x86_64 by Andi Kleen
see: [PATCH] x86_64: Some fixes for single step handling
commit: be61bff7

But it was never applied to the ia32 emulation code which breaks some
copy-protection schemes under wine when running on x86_64.
Signed-off-by: default avatarPeter Beutner <p.beutner@gmx.net>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 60917a38
...@@ -353,7 +353,6 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __ ...@@ -353,7 +353,6 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
struct pt_regs *regs, unsigned int mask) struct pt_regs *regs, unsigned int mask)
{ {
int tmp, err = 0; int tmp, err = 0;
u32 eflags;
tmp = 0; tmp = 0;
__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
...@@ -378,10 +377,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __ ...@@ -378,10 +377,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
err |= __put_user(current->thread.trap_no, &sc->trapno); err |= __put_user(current->thread.trap_no, &sc->trapno);
err |= __put_user(current->thread.error_code, &sc->err); err |= __put_user(current->thread.error_code, &sc->err);
err |= __put_user((u32)regs->rip, &sc->eip); err |= __put_user((u32)regs->rip, &sc->eip);
eflags = regs->eflags; err |= __put_user((u32)regs->eflags, &sc->eflags);
if (current->ptrace & PT_PTRACED)
eflags &= ~TF_MASK;
err |= __put_user((u32)eflags, &sc->eflags);
err |= __put_user((u32)regs->rsp, &sc->esp_at_signal); err |= __put_user((u32)regs->rsp, &sc->esp_at_signal);
tmp = save_i387_ia32(current, fpstate, regs, 0); tmp = save_i387_ia32(current, fpstate, regs, 0);
...@@ -505,13 +501,9 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -505,13 +501,9 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
regs->ss = __USER32_DS; regs->ss = __USER32_DS;
set_fs(USER_DS); set_fs(USER_DS);
if (regs->eflags & TF_MASK) { regs->eflags &= ~TF_MASK;
if (current->ptrace & PT_PTRACED) { if (test_thread_flag(TIF_SINGLESTEP))
ptrace_notify(SIGTRAP); ptrace_notify(SIGTRAP);
} else {
regs->eflags &= ~TF_MASK;
}
}
#if DEBUG_SIG #if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
...@@ -605,13 +597,9 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -605,13 +597,9 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
regs->ss = __USER32_DS; regs->ss = __USER32_DS;
set_fs(USER_DS); set_fs(USER_DS);
if (regs->eflags & TF_MASK) { regs->eflags &= ~TF_MASK;
if (current->ptrace & PT_PTRACED) { if (test_thread_flag(TIF_SINGLESTEP))
ptrace_notify(SIGTRAP); ptrace_notify(SIGTRAP);
} else {
regs->eflags &= ~TF_MASK;
}
}
#if DEBUG_SIG #if DEBUG_SIG
printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment