From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 13 Nov 2018 00:07:58 -0000 Received: from smtp.eu.citrix.com ([185.25.65.24]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gMMFI-0008K3-JG for speck@linutronix.de; Tue, 13 Nov 2018 01:07:57 +0100 Subject: [MODERATED] Re: [PATCH 2/4] RFC-MDSv1 0 References: From: Andrew Cooper Message-ID: Date: Tue, 13 Nov 2018 00:07:47 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="2HEsV1vooqbgd7vIbemge9obH6IdKJjij"; protected-headers="v1" To: speck@linutronix.de List-ID: --2HEsV1vooqbgd7vIbemge9obH6IdKJjij Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-GB On 12/11/2018 03:41, speck for Andi Kleen wrote: > @@ -329,6 +331,12 @@ For 32-bit we have the following conventions - ker= nel is built with > =20 > #endif > =20 > +.macro EXIT_MDS > + /* Clear CPU buffers that could leak. Instruction must be in memory f= orm. */ > + ALTERNATIVE "", __stringify(pushq $__USER_DS ; verw (%rsp) ; addq $8,= %rsp),\ > + X86_FEATURE_MB_CLEAR The code sample from the slides is push $0.=C2=A0 Here, you are forcing a= n implicit access into the GDT by using a non-NUL selector, which is a compound performance hit. What I am considering for Xen is to have a dedicated uint16_t nul_selector and referencing that via a RIP-relative access, which also disassembles to something obvious. ~Andrew --2HEsV1vooqbgd7vIbemge9obH6IdKJjij--