Development issues regarding the cerowrt test router project
 help / color / mirror / Atom feed
From: "dpreed@deepplum.com" <dpreed@deepplum.com>
To: "Jonathan Morton" <chromatix99@gmail.com>
Cc: "Dave Taht" <dave.taht@gmail.com>,
	"Joel Wirāmu Pauling" <joel@aenertia.net>,
	cerowrt-devel@lists.bufferbloat.net
Subject: Re: [Cerowrt-devel] Spectre and EBPF JIT
Date: Fri, 5 Jan 2018 10:35:45 -0500 (EST)	[thread overview]
Message-ID: <1515166545.80420063@apps.rackspace.com> (raw)
In-Reply-To: <EEA16134-72C4-4A35-ACB1-0F6FB29B2718@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4333 bytes --]


One of the most troubling "overreactions" is due to the fact that the POC by Google Project Zero describes an attack on the hypervisor host memory under KVM.
In fine print, and not very explicitly in the Project Zero description, is that the version of KVM that was hacked was dependent on the hypervisor being mapped into the linear address space of the guest kernel.
In a hypervisor that uses VMX extensions, the EPT during guest execution doesn't even provide addressability to the hypervisor code and data. (I haven't inspected KVM's accelerated mode, but I can't see why it would have the EPT map non-guest memory. I know VMWare does not.)
 
This is validated by a posting from QEMU re KVM, [ https://www.qemu.org/2018/01/04/spectre/ ]( https://www.qemu.org/2018/01/04/spectre/ ) , again a little hard to understand if you don't know how VMX and EPT's work.
 
What this means is that older cloud VMs based on techniques used in paravirtualization (Xen, ancient QEMU, older VMware) may be susceptible to accessing hypervisor state via Spectre v1.
 
But newer so-called hardware-accelerated VMs based on VMX extensions and using the EPT are isolated to a much larger extent, making Spectre v1 pretty useless.
 
Thus, the "overreaction" is that ALL VM's are problematic.  This is very far from true. Hardware-accelerated VM's hypervisors are not vulnerable to Meltdown, Spectre v2, and probably not Spectre v1.
 
Of course, *within* a particular VM, the guest kernel and other processes are vulnerable. But there is no inter-VM path that has been demonstrated, nor do any of the discussions explain any means for using speculative execution and branch misprediction between VMs running under different EPT's.
 
So for the cloud, and also for NVF's that are run on accelerated HVM's, the problem is either non-existent or yet to be discovered.
 
Of course the "press" wants everyone to be superafraid, so if they can say "KVM is affected" that causes the mob to start running for the exits!
 
Summary: hardware virtualization appears to be a pragmatic form of isolation that works. And thus many cloud providers are fine.
 
 
 
-----Original Message-----
From: "Jonathan Morton" <chromatix99@gmail.com>
Sent: Friday, January 5, 2018 9:07am
To: "Dave Taht" <dave.taht@gmail.com>
Cc: "dpreed@deepplum.com" <dpreed@deepplum.com>, "Joel Wirāmu Pauling" <joel@aenertia.net>, cerowrt-devel@lists.bufferbloat.net
Subject: Re: [Cerowrt-devel] Spectre and EBPF JIT



> On 5 Jan, 2018, at 6:53 am, Dave Taht <dave.taht@gmail.com> wrote:
> 
> It took me a long while to digest that one. The branch predictor
> analysis of haswell was easiest to understand (and AMD claims to have
> an AI based one), and perhaps scrambling that at random intervals
> would help? (this stuff is now way above my pay grade)

Software mitigations for all three attacks have been developed during the "responsible disclosure" period.

Spectre v1: adding an LFENCE instruction (memory load fence) to JIT code performing a bounds-checked array read. This is basically a userspace fix for a userspace attack. Firefox just got this, Chrome undoubtedly will too, if it hasn't already.

Spectre v2: three different mitigations are appropriate for different families of CPU:

 https://lkml.org/lkml/2018/1/4/742

On AMD CPUs, the small risk actually existing (because AMD's BTB is much less prone to poisoning than Intel's) is erased by adding LFENCE to privileged indirect branches. This has only a very small cost.

On Intel CPUs until Broadwell inclusive (and Silvermont onwards), a "retpoline" structure is necessary and sufficient. This has a bigger cost than LFENCE and is pretty ugly to look at, but it's still relatively minor.

On Skylake, Kaby Lake and Coffee Lake, something more exotic is required - I think it involves temporarily disabling the BTB during privileged indirect branches. That's *really* ugly, and involves tweaking poorly-documented MSRs.

Something similar in nature to the above should also work for affected ARM cores.

Meltdown: nothing is required for AMD CPUs. Unmapping the privileged addresses when returning to userspace is sufficient for Intel, but incurs a big performance overhead for syscalls. The same is likely true for any other affected CPUs.

 - Jonathan Morton


[-- Attachment #2: Type: text/html, Size: 7008 bytes --]

  reply	other threads:[~2018-01-05 15:35 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-01 23:08 [Cerowrt-devel] KASLR: Do we have to worry about other arches than x86? Dave Taht
     [not found] ` <CAJq5cE23bbiPE0a_9zd1VLnO7=c7bjmwwxVwaD2=to3fg5TOjA@mail.gmail.com>
2018-01-01 23:27   ` Jonathan Morton
2018-01-02 19:06 ` Jonathan Morton
2018-01-04 12:09   ` Jonathan Morton
2018-01-04 13:38     ` Dave Taht
2018-01-04 13:48       ` Jonathan Morton
2018-01-04 13:59         ` Dave Taht
2018-01-04 14:49           ` Jonathan Morton
2018-01-04 14:53             ` Dave Taht
2018-01-04 20:28               ` dpreed
2018-01-04 21:20                 ` Jonathan Morton
2018-01-04 21:40                 ` Dave Taht
2018-01-04 21:51                   ` valdis.kletnieks
2018-01-04 21:44     ` Joel Wirāmu Pauling
2018-01-04 21:47       ` Dave Taht
2018-01-04 21:52         ` Joel Wirāmu Pauling
2018-01-04 21:54           ` Dave Taht
2018-01-04 21:57             ` Joel Wirāmu Pauling
     [not found]           ` <1515103187.670416570@apps.rackspace.com>
2018-01-04 22:02             ` Joel Wirāmu Pauling
     [not found]       ` <1515103048.715224709@apps.rackspace.com>
2018-01-04 22:00         ` Joel Wirāmu Pauling
2018-01-04 22:09           ` dpreed
2018-01-04 22:13             ` Joel Wirāmu Pauling
2018-01-04 22:15             ` Dave Taht
2018-01-04 22:26             ` Jonathan Morton
2018-01-04 22:35               ` Joel Wirāmu Pauling
2018-01-04 22:58                 ` [Cerowrt-devel] Spectre and EBPF JIT dpreed
2018-01-05  4:53                   ` Dave Taht
2018-01-05 14:07                     ` Jonathan Morton
2018-01-05 15:35                       ` dpreed [this message]
2018-01-05 19:18                         ` Jonathan Morton
2018-01-05 20:15                           ` David Lang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1515166545.80420063@apps.rackspace.com \
    --to=dpreed@deepplum.com \
    --cc=cerowrt-devel@lists.bufferbloat.net \
    --cc=chromatix99@gmail.com \
    --cc=dave.taht@gmail.com \
    --cc=joel@aenertia.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox