Meltdown from a CPU architect's view

By: dmcq (dmcq.delete@this.fano.co.uk),
Room: Moderated Discussions
rwessel (robertwessel.delete@this.yahoo.com) on February 5, 2018 3:57 pm wrote:
> anon (spam.delete.delete@this.this.spam.com) on February 5, 2018 11:16 am wrote:
> > dmcq (dmcq.delete@this.fano.co.uk) on February 5, 2018 10:24 am wrote:
> > > anon (spam.delete.delete@this.this.spam.com) on February 5, 2018 8:39 am wrote:
> > > > dmcq (dmcq.delete@this.fano.co.uk) on February 5, 2018 6:46 am wrote:
> > > > > Ray Terry (rterry.delete@this.example.edu) on February 4, 2018 7:33 pm wrote:
> > > > > > Ronald Maas (ronaldjmaas.delete@this.gmail.com) on January 17, 2018 11:51 am wrote:
> > > > > > > Spectre may be more difficult to mitigate. But an essential ingredient for a successful Spectre
> > > > > > > attack is the ability of an adversary process to manipulate the branch predictor so it speculative
> > > > > > > executes arbitrary code fragments in the context of a victim process. This manipulation can be
> > > > > > > mitigated by including ASID + privilege level bits into any table lookups done by the branch predictor
> > > > > > > (as pointed out by several people in this thread). In addition the OS should perform a (partial)
> > > > > > > flush of the BTB during context switch in case multiple processes share an ASID. E.g. when system
> > > > > > > is running more active processes than the number of available ASID values.
> > > > > > >
> > > > > > > Now with checking on ASID + privilege level bits in place, the only vector of attack remaining
> > > > > > > for Spectre is within the same address space. This is something that hopefully can be addressed
> > > > > > > within each application. E.g. proper sandboxing of any untrusted code.
> > > > > >
> > > > > > The problem is that same address space is not only a realistic attack,
> > > > > > it's the easiest form, and the one in the original Spectre PoC.
> > > > > >
> > > > > > Spectre makes software sandboxing much harder. We thought we had sandboxed VMs figured
> > > > > > out, and are using them extensively in the form of client-side Javascript and kernel
> > > > > > (e)BPF. (I'm sure there are other examples, but those are the biggies.)
> > > > > >
> > > > > > And although it's primarily a software issues (since only software even knows where the sandbox
> > > > > > boundary is) hardware has to provide the basic ingredients out of which software can build a non-leaking
> > > > > > sandbox. Right now, it's not even 100% clear what those are. A faster or tweaked LFENCE?
> > > > >
> > > > > I don't see fences as a solution. We need to turn the Spectre problem into a Meltdown type problem
> > > > > which means having a new privilege level or a different process or new permissions on the pages.
> > > > >
> > > >
> > > > I'm not sure what you mean. Spectre v2 can be solved by using existing privilege levels and
> > > > simply seperating the predictions for different processes and different privilege levels.
> > > >
> > > > Spectre v1 would require different privilege levels within the same process, possibly with very rapid
> > > > switching between them. It would be awkward in hardware and there is no OS support for it either.
> > > > Adding an instruction that is actually meant for serialization seems more useful to fix
> > > > potentially existing similar exploits that can't be fixed as easily as bounds checks.
> > >
> > > And turning a Spectre problem into a Meltdown one requires different privileges. Without hardware
> > > changes running a JavaScript task within a current process where it can access things it shouldn't
> > > be able to is a pretty big ask. One can put in fences but that makes the code slower and it will
> > > always be a software solution and we'd be waiting for hackers to get round it or find bugs in the
> > > implementation. The question is how to keep the performance and improve the security.
> > >
> > > > I mean if you want seperate permissions for every single javascript script page
> > > > tables will have to be redesigned completely and thanks to Meltdown checking it
> > > > in the TLB will be on the critical path. Doesn't seem like a good idea to me.
> > >
> > > Yes if you want different JavaScript scripts within a single process not be able to access
> > > each others data then that can't be done with a straightforward change to page tables. I was
> > > only considering the case of a single unsafe state in a process. That certainly does make
> > > things more difficult. Checking at the same place as for Meltdown is the obvious way to stop
> > > all the problems but that requires there to be some privilege that can be checked for.
> >
> > Well if you only want a single unsafe state per process then you have to split your processes anyway.
> > We can already do that.
> >
> > One extra privilege level (or two if we combine it with the user/supervisor bit) wouldn't be that
> > difficult to implement but it would still end up being very awkward. You do not want to let a process
> > that runs untrusted code mess with the page tables so all of that needs to go through the OS.
> >
> > There are a lot of things that would be nice to have, but won't be added because no one actually
> > needs them to make software work, so there is no incentive to add them to the hardware.
> > I'm pretty sure if we wanted we could play stupid games with
> > ring 1/2 and segments to get isolation within a process.
>
>
> FWIW, Z has implemented such a facility for years (the uninformatively named "Storage-Protection-Override
> Control"), allowing two protection domains within an address space. This was added for CICS (and a few
> other subsystems), which executed code for transactions in the same address space as the subsystem itself.
> Somewhat simplified, Z has a protection key on each physical page (in addition to what happens with the
> page tables), and the key of the page being accessed has to match the key set in the PSW. CICS will allocate
> storage for the transactions in key 9 (it does require some help from the OS for that), and uses key 8 storage
> for itself. CICS switches to key 9 when dispatching transaction (user) code (which it can do via an instruction,
> without OS intervention, once the OS sets up the proper mask allowing that).
>
> Obviously you'd do a purely page-table based approach for any other systems (storage keys have
> existed since the S/360, when the pre-virtual memory OS's provided a SAS-like view of the world,
> and used those storage keys to protect programs from each other, and so were some-what natural
> to reuse for this purpose), but there is some operational precedent for a facility like that.

Thanks for that. I really should study IBM mainframes more, They probably say, oh that old problem about lots of things that people think are new. :) I wonder what the world would be like today if the PC had been an IBM 370 compatible rather than using Intel x86. No chance of them selling the chips to other manufacturers so they wouldn't have created a market so it wouldn't have happened I guess.
< Previous Post in ThreadNext Post in Thread >
Thread (123 posts)
TopicPosted ByPosted
Meltdown from a CPU architect's viewDavid Kanter
  Meltdown from a CPU architect's viewYoav
    Meltdown from a CPU architect's viewanon
      Meltdown from a CPU architect's viewanon
        Meltdown from a CPU architect's viewanon
        Meltdown from a CPU architect's viewRonald Maas
  Meltdown from a CPU architect's viewRicardo B
    Meltdown from a CPU architect's viewMichael_S
    Meltdown from a CPU architect's viewanon
    Meltdown from a CPU architect's viewLinus Torvalds
      Meltdown from a CPU architect's viewEmil Briggs
        Meltdown from a CPU architect's viewLinus Torvalds
          Meltdown from a CPU architect's viewMichael S
            sky is fallingMichael S
              meltdown and public cloudRichardC
                meltdown and public cloudmpx
                  meltdown and public cloudRichardC
                meltdown and public cloudEmil Briggs
                  meltdown and public cloudRichardC
                  meltdown and public cloudAaron Spink
                    meltdown and public cloud-
                meltdown and public cloudLinus Torvalds
                  meltdown and public cloudanon
                    meltdown and public cloudEmil Briggs
                    meltdown and public cloudGabriele Svelto
                    meltdown and public cloudLinus Torvalds
                  meltdown and public cloudGabriele Svelto
                    meltdown and public cloudLinus Torvalds
                      meltdown and public cloudhobold
                        meltdown and public cloudgallier2
                      meltdown and public clouddmcq
                        meltdown and public cloudMichael_S
                          meltdown and public cloudGabriele Svelto
                          meltdown and public cloudTravis
                            meltdown and public cloudGabriele Svelto
                              meltdown and public cloudTravis
                                meltdown and public cloudGabriele Svelto
                                  meltdown and public cloudJeff S.
                                    meltdown and public cloudTravis
                                      meltdown and public cloudJeff S.
                                        meltdown and public cloudTravis
                                          meltdown and public cloudTravis
                                  meltdown and public cloudTravis
                                    meltdown and public cloudGabriele Svelto
                                      meltdown and public cloudTravis
                                        meltdown and public cloudGabriele Svelto
                                          meltdown and public cloudMaynard Handley
                                          meltdown and public cloudTravis
                                            meltdown and public cloudGabriele Svelto
                                          meltdown and public cloudBrendan
                                            meltdown and public cloudGabriele Svelto
                            meltdown and public cloudMichael_S
                              meltdown and public clouddmcq
                              meltdown and public cloudTravis
                            meltdown and public cloudalistair
                              meltdown and public cloudGabriele Svelto
                                meltdown and public clouddmcq
                                meltdown and public cloudRonald Maas
                                  meltdown and public cloudLinus Torvalds
                                    meltdown and public cloudTravis
                                      meltdown and public cloudLinus Torvalds
                                        meltdown and public cloudTravis
                                          meltdown and public cloudGabriele Svelto
                                            meltdown and public cloudTravis
                                              meltdown and public cloudGabriele Svelto
                                              meltdown and public cloudMaynard Handley
                                                meltdown and public cloudTravis
                                                  meltdown and public cloudGabriele Svelto
                                    meltdown and public cloudRonald Maas
                                    meltdown and public clouddmcq
                      meltdown and public cloudGabriele Svelto
                        meltdown and public cloudFoo_
                          meltdown and public cloudGabriele Svelto
                            Sure. That's not a reason to make things worse. (NT)Foo_
                  meltdown and public cloudRichardC
                    meltdown and public cloudMatt Sayler
                      EC2, not ECS above (NT)Matt Sayler
                      meltdown and public cloudRichardC
              sky is fallingmpx
              sky is falling - meet TLBleedMichael S
                sky is falling - meet TLBleedhobold
                  sky is falling - meet TLBleedanon
                sky is falling - meet TLBleedAndrew Clough
                  sky is falling - meet TLBleedNoSpammer
                sky is falling - meet TLBleedFoo_
                  sky is falling - meet TLBleedMichael S
                    sky is falling - meet TLBleedhobold
                      sky is falling - meet TLBleedMichael S
          Meltdown from a CPU architect's viewhobold
          RDCL_NO and IBRS_ALLanonymou5
            RDCL_NO and IBRS_ALLLinus Torvalds
              RDCL_NO and IBRS_ALLDariusz G. Jagielski
            RDCL_NO and IBRS_ALLTravis
          Meltdown from a CPU architect's viewIan Ameline
            Your "fix" is really, really bad and does not really fix anythingHeikki Kultala
            Meltdown from a CPU architect's viewMegol
              Meltdown from a CPU architect's viewIan Ameline
              Meltdown from a CPU architect's viewAaron Spink
                Meltdown from a CPU architect's viewanon
                  Meltdown from a CPU architect's viewRonald Maas
                    Meltdown from a CPU architect's viewRay Terry
                      Meltdown from a CPU architect's viewdmcq
                        Meltdown from a CPU architect's viewanon
                          Meltdown from a CPU architect's viewdmcq
                            Meltdown from a CPU architect's viewanon
                              Meltdown from a CPU architect's viewrwessel
                                Meltdown from a CPU architect's viewdmcq
          Cannonlake or icelakeDavid Kanter
            Cannonlake or icelakeanon
              Anyway, IMHO no more new server SKUs with Meltdown insideAlberto
                Anyway, IMHO no more new server SKUs with Meltdown insideMichael_S
                  Anyway, IMHO no more new server SKUs with Meltdown insideanon
                    Sounds like you agree about Skylake-D (NT)Michael_S
                      I agreed only about some quarters (or an year) in redAlberto
                        I agreed only about some quarters (or an year) in redMichael_S
          Meltdown from a CPU architect's viewKevin G
            Meltdown from a CPU architect's viewDoug S
          Meltdown from a CPU architect's viewjoema
            Meltdown from a CPU architect's viewdmcq
      Meltdown from a CPU architect's viewGabriele Svelto
        Meltdown from a CPU architect's viewRichardC
      Meltdown from a CPU architect's viewGroo
      Meltdown from a CPU architect's viewanon