Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753179AbeAFTmB (ORCPT + 1 other); Sat, 6 Jan 2018 14:42:01 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46665 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbeAFTl7 (ORCPT ); Sat, 6 Jan 2018 14:41:59 -0500 Date: Sat, 6 Jan 2018 20:41:34 +0100 (CET) From: Thomas Gleixner To: Alexei Starovoitov cc: Dan Williams , Alan Cox , Linus Torvalds , Linux Kernel Mailing List , linux-arch@vger.kernel.org, Andi Kleen , Arnd Bergmann , Greg Kroah-Hartman , Peter Zijlstra , Netdev , Ingo Molnar , "H. Peter Anvin" Subject: Re: [PATCH 06/18] x86, barrier: stop speculation for failed access_ok In-Reply-To: <20180106192517.ykvlcq4564cqy4u6@ast-mbp> Message-ID: References: <151520099201.32271.4677179499894422956.stgit@dwillia2-desk3.amr.corp.intel.com> <151520102670.32271.8447983009852138826.stgit@dwillia2-desk3.amr.corp.intel.com> <20180106123242.77f4d860@alans-desktop> <20180106181331.mmrqwwbu2jcjj2si@ast-mbp> <20180106183937.vkseldf4arkdlkum@ast-mbp> <20180106192517.ykvlcq4564cqy4u6@ast-mbp> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Sat, 6 Jan 2018, Alexei Starovoitov wrote: > On Sat, Jan 06, 2018 at 10:54:27AM -0800, Dan Williams wrote: > > On Sat, Jan 6, 2018 at 10:39 AM, Alexei Starovoitov > > wrote: > > [..] > > >> retpoline is variant-2, this patch series is about variant-1. > > > > > > that's exactly the point. Don't slow down the kernel with lfences > > > to solve variant 1. retpoline for 2 is ok from long term kernel > > > viability perspective. > > > > > > > Setting aside that we still need to measure the impact of these > > changes the end result will still be nospec_array_ptr() sprinkled in > > various locations. So can we save the debate about what's inside that > > macro on various architectures and at least proceed with annotating > > the problematic locations? Perhaps we can go a step further and have a > > config option to switch between the clever array_access() approach > > from Linus that might be fine depending on the compiler, and the > > cpu-vendor-recommended not to speculate implementation of > > nospec_array_ptr(). > > recommended by panicing vendors who had no better ideas? > Ohh, speculation is exploitable, let's stop speculation. > Instead of fighting it we can safely steer it where it doesn't leak > kernel data. AND approach is doing exactly that. For one particular architecture and that's not a solution for generic code. Aside of that I fundamentally disagree with your purely performance optimized argumentation. We need to make sure that we have a solution which kills the problem safely and then take it from there. Correctness first, optimization later is the rule for this. Better safe than sorry. Thanks, tglx