Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753541AbeAFXb5 (ORCPT + 1 other); Sat, 6 Jan 2018 18:31:57 -0500 Received: from mail-ot0-f173.google.com ([74.125.82.173]:33368 "EHLO mail-ot0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752630AbeAFXbz (ORCPT ); Sat, 6 Jan 2018 18:31:55 -0500 X-Google-Smtp-Source: ACJfBouEn59wDODQz5MDf+UmnwpcC2sToJjPxPazy8NR4NdH+N1RId3PyIMzEaRyXswqvO+Ox+yC2+QPwNm/PK85KE4= MIME-Version: 1.0 In-Reply-To: References: <151520099201.32271.4677179499894422956.stgit@dwillia2-desk3.amr.corp.intel.com> <151520102670.32271.8447983009852138826.stgit@dwillia2-desk3.amr.corp.intel.com> From: Dan Williams Date: Sat, 6 Jan 2018 15:31:54 -0800 Message-ID: Subject: Re: [PATCH 06/18] x86, barrier: stop speculation for failed access_ok To: Linus Torvalds Cc: Linux Kernel Mailing List , linux-arch@vger.kernel.org, Andi Kleen , Arnd Bergmann , Greg Kroah-Hartman , Peter Zijlstra , Network Development , "the arch/x86 maintainers" , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Alan Cox Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Fri, Jan 5, 2018 at 7:09 PM, Linus Torvalds wrote: > On Fri, Jan 5, 2018 at 6:52 PM, Linus Torvalds > wrote: >> >> The fact is, we have to stop speculating when access_ok() does *not* >> fail - because that's when we'll actually do the access. And it's that >> access that needs to be non-speculative. > > I also suspect we should probably do this entirely differently. > > Maybe the whole lfence can be part of uaccess_begin() instead (ie > currently 'stac()'). That would fit the existing structure better, I > think. And it would avoid any confusion about the whole "when to stop > speculation". I assume if we put this in uaccess_begin() we also need audit for paths that use access_ok but don't do on to call uaccess_begin()? A quick glance shows a few places where we are open coding the stac(). Perhaps land the lfence in stac() directly?