Commit 9da21666 authored by Daniel Jacobowitz's avatar Daniel Jacobowitz Committed by Linus Torvalds

[PATCH] x86: fix TF bit corner case with ptrace and signals

If a debugger set the TF bit, make sure to clear it when creating a
signal context.  Otherwise, TF will be incorrectly restored by
sigreturn.
Signed-off-by: default avatarDaniel Jacobowitz <dan@debian.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7e7c5bf0
......@@ -277,6 +277,18 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
{
int tmp, err = 0;
/*
* If TF is set due to a debugger (PT_DTRACE), clear the TF
* flag so that register information in the sigcontext is
* correct.
*/
if (unlikely(regs->eflags & TF_MASK)) {
if (likely(current->ptrace & PT_DTRACE)) {
current->ptrace &= ~PT_DTRACE;
regs->eflags &= ~TF_MASK;
}
}
tmp = 0;
__asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
err |= __put_user(tmp, (unsigned int __user *)&sc->gs);
......
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