Return-path: Received: from mta.outflux.net ([2001:19d0:2:6:c0de:0:736d:7471] helo=smtp.outflux.net) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fEjA7-0004ED-1X for speck@linutronix.de; Sat, 05 May 2018 00:26:48 +0200 Received: from www.outflux.net (serenity.outflux.net [10.2.0.2]) by vinyl.outflux.net (8.15.2/8.15.2/Debian-3) with ESMTP id w44MQdwH001466 for ; Fri, 4 May 2018 15:26:39 -0700 Date: Fri, 4 May 2018 15:26:39 -0700 From: Kees Cook Subject: [MODERATED] Re: [PATCH 0/5] SSB extra 0 Message-ID: <20180504222639.GJ6017@outflux.net> References: <20180503232757.GF6017@outflux.net> <994d4e30-f0f2-69e9-3202-ac1def49ea53@linux.intel.com> MIME-Version: 1.0 In-Reply-To: <994d4e30-f0f2-69e9-3202-ac1def49ea53@linux.intel.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Thu, May 03, 2018 at 06:37:46PM -0700, speck for Dave Hansen wrote: > On 05/03/2018 04:27 PM, speck for Kees Cook wrote:> On Thu, May 03, 2018 > at 03:29:43PM -0700, speck for Dave Hansen wrote: > >> BPF is a potential source of gadgets that can be used for memory > >> diambiguation-based attacks. To help mitigate these, we enable the > >> bit in SPEC_CTRL which enables the reduced (memory) speculation > >> mode on the processor when runing BPF code. > > > > Do you mean eBPF, or even cBPF? > > Right or wrong, my assumption is that you can build gadgets with any of > the variants. I haven't looked into detail to whether the classic VM > and enhanced VM have the building blocks. > [...] > Were we just not concerned before because seccomp didn't use arrays? My understanding from Jann Horn (who looked at the seccomp cases before) was that eBPF maps were required for SpectreV1. I've asked him for clarification on SSB, but I think the reasoning holds there too. Specifically, my memory of the details are that since seccomp uses a subset of even cBPF and can only use absolute indexing (not dynamic), cBPF programs cannot be constructed that do array access outside of the seccomp data buffer (which consists entirely of userspace information: pid, syscall number, syscall arguments), not even from the 16-byte "scratch" space. i.e. the seccomp cBPF verifier, seccomp_check_filter(), results in no seccomp cBPF programs having the "untrusted_offset_from_caller" indexing (to borrow the variable name from the Project Zero write-up on SpectreV1). It also has no maps (so there cannot be data sharing between multiple seccomp cBPF programs nor to the outside world). And finally, the only "visible" output from seccomp is via syscall behaviors, which would create too much noise for that exfiltration path. Note, though, that I am not an expert in eBPF nor writing speculation exploits. Which gets us to the next question... > [...] > Either way, I don't think we have the BPF experts on this list, yet. > I'm a BPF newbie for sure. What's the plan for involving them? Whatever the case, I think we need to find a way to exempt seccomp cBPF from this... -Kees -- Kees Cook @outflux.net