lkml.org 
[lkml]   [2021]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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' ?

> +}

\
 
 \ /
  Last update: 2021-03-02 17:40    [W:0.057 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site