[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtnsTs8XkPS4nXdi@google.com>
Date: Thu, 21 Jul 2022 17:16:14 -0700
From: Sami Tolvanen <samitolvanen@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Joao Moreira <joao@...rdrivepizza.com>,
LKML <linux-kernel@...r.kernel.org>,
the arch/x86 maintainers <x86@...nel.org>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
"Cooper, Andrew" <andrew.cooper3@...rix.com>,
Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>,
Johannes Wikner <kwikner@...z.ch>,
Alyssa Milburn <alyssa.milburn@...ux.intel.com>,
Jann Horn <jannh@...gle.com>, "H.J. Lu" <hjl.tools@...il.com>,
"Moreira, Joao" <joao.moreira@...el.com>,
"Nuzman, Joseph" <joseph.nuzman@...el.com>,
Steven Rostedt <rostedt@...dmis.org>,
"Gross, Jurgen" <jgross@...e.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Peter Collingbourne <pcc@...gle.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [patch 00/38] x86/retbleed: Call depth tracking mitigation
On Thu, Jul 21, 2022 at 08:27:12PM +0200, Peter Zijlstra wrote:
> On Thu, Jul 21, 2022 at 11:06:42AM -0700, Linus Torvalds wrote:
> > On Thu, Jul 21, 2022 at 10:56 AM Peter Zijlstra <peterz@...radead.org> wrote:
> > >
> > > this seems to work, let me go hack the kernel..
> >
> > Am I missing something?
> >
> > Isn't this generating
> >
> > movl $~IMM,%r10d
> > negl %r10d
> > cmpl %r10d,-4(%calldest)
> >
> > for the sequence?
> >
> > That seems bogus for two reasons:
> >
> > (a) 'neg' is not the opposite of '~'. Did you mean 'notl' or did you mean '-'?
> >
> > Or am I missing something entirely?
>
> No, you're right, I'm being daft again.
>
> > (b) since you have that r10 use anyway, why can't you just generate the simpler
> >
> > movl $-IMM,%r10d
> > addl -4(%calldest),%r10d
> >
> > instead? You only need ZF anyway.
>
> Right, lemme see if I can wrangle llvm to generate that.
That looks good to me. I updated my LLVM tree to generate this code
for the checks:
https://github.com/samitolvanen/llvm-project/commits/kcfi
Sami
Powered by blists - more mailing lists