Re: x86: do_debug && PTRACE_SINGLESTEP broken by08d68323d1f0c34452e614263b212ca556dae47f

From: Oleg Nesterov
Date: Thu Dec 17 2009 - 21:16:33 EST


On 12/17, Roland McGrath wrote:
>
> Comparing to the old (2.6.32) logic, I think it might be this (untested).
> I also note this is the sole use of get_si_code, seems like it should
> just be rolled in here.

Well, it is too late for me to even try to read this patch ;)

but...

> @@ -569,14 +568,15 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
> * We already checked v86 mode above, so we can check for kernel mode
> * by just checking the CPL of CS.
> */
> + dr6 = tsk->thread.debugreg6;

why? we have "tsk->thread.debugreg6 = dr6" above

> if ((dr6 & DR_STEP) && !user_mode(regs)) {
> tsk->thread.debugreg6 &= ~DR_STEP;
> set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
> regs->flags &= ~X86_EFLAGS_TF;

this looks strange... we set TIF_SINGLESTEP but clear X86_EFLAGS_TF

> + } else if (dr6 & (DR_STEP | DR_TRAP_BITS)) {
> + send_sigtrap(tsk, regs, error_code, get_si_code(dr6));
> }
> - si_code = get_si_code(tsk->thread.debugreg6);
> - if (tsk->thread.debugreg6 & (DR_STEP | DR_TRAP_BITS))
> - send_sigtrap(tsk, regs, error_code, si_code);
> +

can't understand how this change can fix the problem. We should always
send SIGTRAP if the task returns to user-mode with X86_EFLAGS_TF?

OK. I blindly applied this patch, step-simple still fails.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/