Messages in this thread | | | Date | Tue, 2 Mar 2021 14:58:01 +0100 | From | Peter Zijlstra <> | Subject | Re: [RFC PATCH 1/1] x86/kprobes: Use int3 instead of debug trap for single-step |
| |
On Tue, Mar 02, 2021 at 09:54:43AM +0100, Peter Zijlstra wrote:
> +static void kprobe_emulate_jcc(struct kprobe *p, struct pt_regs *regs) > +{ > + bool invert = p->ainsn.jcc.type & 1; > + bool match; > + > + if (p->ainsn.jcc.type < 0xc) { > + match = regs->flags & jcc_mask[p->ainsn.jcc.type >> 1]; > + } else { > + match = ((regs->flags & X86_EFLAGS_SF) >> X86_EFLAGS_SF_BIT) ^ > + ((regs->flags & X86_EFLAGS_OF) >> X86_EFLAGS_OF_BIT); > + if (p->ainsn.jcc.type >= 0xe) > + match = match && (regs->flags & X86_EFLAGS_ZF); > + } > + __kprobe_emulate_jmp(p, regs, (match && !invert) || (!match && invert));
Also, isn't that: 'match ^ invert' ?
> +}
| |