From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linutronix.de (193.142.43.55:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 19 Nov 2019 18:46:37 -0000 Received: from mail.kernel.org ([198.145.29.99]) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iX8WK-0001M8-12 for speck@linutronix.de; Tue, 19 Nov 2019 19:46:36 +0100 Date: Tue, 19 Nov 2019 19:46:26 +0100 From: Greg KH Subject: [MODERATED] Re: LVI Message-ID: <20191119184626.GA2326631@kroah.com> References: <20191119174008.7dbymix2eo4mrv57@treble> <20191119181257.GA2283647@kroah.com> <20191119182120.w4pjlvkjncqmv7ln@treble> MIME-Version: 1.0 In-Reply-To: <20191119182120.w4pjlvkjncqmv7ln@treble> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Tue, Nov 19, 2019 at 12:21:20PM -0600, speck for Josh Poimboeuf wrote: > On Tue, Nov 19, 2019 at 07:12:57PM +0100, speck for Greg KH wrote: > > > --- a/arch/x86/include/asm/uaccess.h > > > +++ b/arch/x86/include/asm/uaccess.h > > > @@ -119,9 +119,9 @@ extern int __get_user_bad(void); > > > > > > #define __uaccess_begin() stac() > > > #define __uaccess_end() clac() > > > -#define __uaccess_begin_nospec() \ > > > +#define __uaccess_end_nospec() \ > > > ({ \ > > > - stac(); \ > > > + clac(); \ > > > barrier_nospec(); \ > > > }) > > > > Um, don't we _really_ want stac() here? That's the only thing that is > > saving our butts in a number of places. Why get rid of it? Otherwise > > it should be easy to cause a speculatave load by userspace for any > > address they feel like. > > > > Or am I mistaken about what you are trying to solve here? > > Notice I renamed it to from __uaccess_begin_nospec() to > __uaccess_end_nospec() ;-) > > The idea is to move the LFENCE from _before_ the copy to _after_ the > copy. I didn't mess with stac/clac. Ah, ick, sorry, totally mis-read that thing. Nevermind... greg k-h