[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YD5EaUKI8lswWPMq@hirez.programming.kicks-ass.net>
Date: Tue, 2 Mar 2021 14:58:01 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>, Ingo Molnar <mingo@...nel.org>,
Oleg Nesterov <oleg@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
"David S . Miller" <davem@...emloft.net>, X86 ML <x86@...nel.org>,
Andrew Cooper <andrew.cooper3@...rix.com>,
Steven Rostedt <rostedt@...dmis.org>
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' ?
> +}
Powered by blists - more mailing lists