Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1f8f8u-0003QK-Tj for speck@linutronix.de; Wed, 18 Apr 2018 06:56:29 +0200 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1F74F8D76C for ; Wed, 18 Apr 2018 04:56:22 +0000 (UTC) Received: from washington.bos.jonmasters.org (ovpn-125-161.rdu2.redhat.com [10.10.125.161]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E04701C71C for ; Wed, 18 Apr 2018 04:56:21 +0000 (UTC) Subject: [MODERATED] Re: GPZv4 From: Jon Masters References: <20180417193105.GD3890@pd.tnic> <476c3e0b-dde6-6e6b-2054-6e71fa2c396b@redhat.com> <20180417203717.GF3890@pd.tnic> <47b619bf-8d07-c465-9017-583cf5ac80ee@redhat.com> <67ef414c-f57c-0300-973b-f8898ee4d3b1@redhat.com> <20180418024816.GA6450@localhost.localdomain> Message-ID: <5f807477-c3f6-1714-83b4-9117caea119c@redhat.com> Date: Wed, 18 Apr 2018 00:56:21 -0400 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="jrAM7B9D2JBOi9cb7lmIVWIPOPiNxGkJW"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --jrAM7B9D2JBOi9cb7lmIVWIPOPiNxGkJW Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 04/17/2018 11:44 PM, Jon Masters wrote: > On 04/17/2018 10:48 PM, speck for Konrad Rzeszutek Wilk wrote: >> And then two more to figure out when to apply the security glue: >> 'boot' or 'userspace'. >=20 > Indeed. Here's the current text as I reworded it: >=20 > --- begin --- > mdd stands for "Memory Disambiguation Disable". It is used to disable > a common industry performance optimization known as "Speculative > Store Bypass" in which loads from addresses to which a recent store > has occurred may (speculatively) see an older value. Intel refers > to this feature as "Memory Disambiguation", which is part of their > "Smart Memory Access" capability in Haswell and later processors. >=20 > Some processors have an implementation bug that enables a cache > side-channel attack against such speculatively read values. An > attacker can create exploit code that allows them to read memory > outside of a sandbox environment (for example, malicious JavaScript > in a web page), or to perform more complex attacks against code > running within the same privilege level, e.g. via the stack. >=20 > We provide two sets of knobs. The first are x86 specific: >=20 > nomdd > mdd=3D[off,auto,on] >=20 > We also support cross-architecture versions of these: >=20 > nossbd > ssbd=3D[off,auto,on] >=20 > By default Memory Disambiguation is enabled hence the parameters are: >=20 > - auto - if possible will disable Memory Disambiguation (MD) at boot > if CPU is vulnerable to speculation attacks against MD > - on - disable Memory Disambiguation > - off - enable Memory Disambiguation >=20 > And as mentioned - some CPUs may have an Memory Disambiguation > implementation is not vulnerable to speculation attack. For those, > the 'auto' (default) option will pick the right choice. > --- end --- Additionally, your previous patch would turn MD back on when in the kernel. I get why, but I think this is not safe. We know there are the usual BPF exploits already, but more novel gadgets are likely, e.g. against kernel stack, so it's definitely not safe to do that IMO. If we're going to do more than a hammer later, then it should be *always* MD disabled in the kernel, and possibly enabled in userspace. I'm keeping spec_ctl_priv for now because I see why it makes sense to have some baseline for the SPEC_CTRL, though I rename it to x86_spec_ctl_priv and kill the other one. Also, we should add a rdmsr to get the initial reset value in case additional bits are defined later (per our discussion the other night, Intel's docs are unclear there). However I'm not making that change at this point - it's a later todo. Jon. --=20 Computer Architect | Sent from my Fedora powered laptop --jrAM7B9D2JBOi9cb7lmIVWIPOPiNxGkJW--