See my previous emails... and a couple of other nits. On 07/31, Sebastian Andrzej Siewior wrote: > > +static int insn_is_popf(const u8 *insn) > +{ > + /* popf */ > + if (insn[0] == 0x9d) > + return 1; > + return 0; > +}
I can't believe I am going to blame the naming ;) But "insn_is_popf" looks confusing, imho. Yes, currently "iret" can't be probed, so (afaics) we only need to check "popf". Still I think the name should be generic, and the comment should explain that only "popf" can be probed. And I think it would be better to pass auprobe, not ->insn. But this all is cosmetic. > +void arch_uprobe_enable_step(struct task_struct *child, > + struct arch_uprobe *auprobe) > +{ > + struct uprobe_task *utask = child->utask; > + struct arch_uprobe_task *autask = &utask->autask; > + struct pt_regs *regs = task_pt_regs(child); > + unsigned long debugctl; > + > + autask->restore_flags = 0; > + if (!(regs->flags & X86_EFLAGS_TF) && > + !insn_is_popf(auprobe->insn)) { > + autask->restore_flags |= UPROBE_CLEAR_TF; This looks correct, but > + debugctl = get_debugctlmsr(); > + if (debugctl & DEBUGCTLMSR_BTF) { No, I don't think "X86_EFLAGS_TF && !insn_is_popf" is right. I guess this mimics "enable_single_step(child) && block" in enable_step(), but we can't trust insn_is_popf(), we should check/clear DEBUGCTLMSR_BTF unconditionally. And get_debugctlmsr() is another reason why arch_uprobe_enable_step() should not have "struct task_struct *child" argument, otherwise the code looks confusing. However, I am not sure we can trust it. We are in kernel mode, DEBUGCTLMSR_BTF can be cleared by kprobes (Ananth, please correct me). I think we need to check TIF_BLOCKSTEP. Oleg. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/