[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210504031616.covixup7rhdil3yq@treble>
Date: Mon, 3 May 2021 22:16:16 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Andy Lutomirski <luto@...nel.org>
Cc: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
David Kaplan <David.Kaplan@....com>,
Andrew Cooper <andrew.cooper3@...rix.com>,
David Woodhouse <dwmw2@...radead.org>,
Kees Cook <keescook@...omium.org>, Jann Horn <jannh@...gle.com>
Subject: Re: Do we need to do anything about "dead µops?"
On Mon, May 03, 2021 at 06:31:21PM -0700, Andy Lutomirski wrote:
> On Mon, May 3, 2021 at 4:30 PM Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> >
> > On Sat, May 01, 2021 at 09:26:33AM -0700, Andy Lutomirski wrote:
> > > Hi all-
> > >
> > > The "I See Dead µops" paper that is all over the Internet right now is
> > > interesting, and I think we should discuss the extent to which we
> > > should do anything about it. I think there are two separate issues:
> > >
> > > First, should we (try to) flush the µop cache across privilege
> > > boundaries? I suspect we could find ways to do this, but I don't
> > > really see the point. A sufficiently capable attacker (i.e. one who
> > > can execute their own code in the dangerous speculative window or one
> > > who can find a capable enough string of gadgets) can put secrets into
> > > the TLB, various cache levels, etc. The µop cache is a nice piece of
> > > analysis, but I don't think it's qualitatively different from anything
> > > else that we don't flush. Am I wrong?
> >
> > Wouldn't this type of gadget (half-v1 gadget + value-dependent-branch)
> > would be much more likely to occur than a traditional Spectre v1
> > (half-v1 gadget + value-addressed-load)?
>
> I don't fully believe this. It's certainly the case that:
>
> if (mispredicted as false)
> return;
> secret = some_secret();
> if (secret == 42)
> do_something();
Well, obviously we should never write secret-protecting code in that
manner.
I was actually thinking more along the lines of
val = 0;
if (user_supplied_idx < ARRAY_SIZE) // trained to speculatively be 'true'
val = boring_non_secret_array[user_supplied_idx];
if (val & 1)
do_something();
In other words, the victim code wouldn't be accessing the secret
intentionally. So there's no reason for it to avoid doing
data-dependent branches.
> will leak the fact that the secret is 42 into the µop cache, but it
> will also leak it into the icache and lots of other things. I see
> nothing new here.
Hm, I suppose. I don't think I'd ever considered that vector though.
All the more reason to mask usercopy addresses...
--
Josh
Powered by blists - more mailing lists