Received: by 10.223.176.46 with SMTP id f43csp2654695wra; Mon, 22 Jan 2018 00:59:59 -0800 (PST) X-Google-Smtp-Source: AH8x226JbqiFrg5sxzzKvb+3O+MiJTlFKjhVr7G2wIPJHmtQzbPVSBNcB06nu/kip+kRAD/1xJ4/ X-Received: by 10.101.102.73 with SMTP id z9mr6623329pgv.448.1516611599266; Mon, 22 Jan 2018 00:59:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516611599; cv=none; d=google.com; s=arc-20160816; b=V0V9QANHkCtAzq/u+NUstYiFalY+DN7vdUiT3mqjoO4i2gBWGwYGPunOYzRyfbupLA JiqaTt/wKpyBPeJ1clmZDgQUZZQiwYL2RitQReTn7uXzHRqdKEzTgYvaJOGLnGjhV/Vg Esp1Sx75NpOyMFNzOiRipGumJVGuPDBK/ACo38wJ99e9Dq5oTLpJ6zlGkEks8EiRNFpn ZGFFvODaaCLtkAXM+TBRwk2BbPssd/MHe+2QxcITeU6L9qqy42Hm5+WoLpyxm3C1ED4I qH64w4sNSZLVtrfgUJKrScAYsSaiunb4nXc+aJDn5WsCQel90r6Aqbav0z8HCoHBtvv0 n1Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=YDlFHLjwiSENIf8DzfbSVL9JjiV1ozioJpwgAzTKTDQ=; b=GGCLptXsa4oKLvU2EgkPGwNdt2IDssVieLjEAizEFS1+g3AHueEqUuFQ/KcIGgR+Hh 5Fnk/PusXyx5Y2q/ikNinZbkBXRC6yGC+0sHuX8cMnV2BQGOWilHXXlmdNUAQoQEK+vf OVAAVCWDC4QQAWaKG/oM+OjtEnEvhR2J47JerA5t9yzcHo3STioCxzIb6qirQoa9ukqg 5xWYyXMLIQFuCS7UxfcNgWC3L6YfQs2o95o+lBXPSDMX9iNXvlJZfw5vXQXBHDspfmrA tS4x85SdbLxwJY6GaG+Lh35F81x8SpPLbFWWqWkidMzzPt0OToV7jInOzCAe4P3KJIbV YR4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si15279401pfh.215.2018.01.22.00.59.45; Mon, 22 Jan 2018 00:59:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753859AbeAVI6N (ORCPT + 99 others); Mon, 22 Jan 2018 03:58:13 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:34192 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732AbeAVIyP (ORCPT ); Mon, 22 Jan 2018 03:54:15 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id AD5EEF2B; Mon, 22 Jan 2018 08:54:14 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Borislav Petkov , David Woodhouse Subject: [PATCH 4.14 81/89] x86/mce: Make machine check speculation protected Date: Mon, 22 Jan 2018 09:46:01 +0100 Message-Id: <20180122084002.566285777@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083954.683903493@linuxfoundation.org> References: <20180122083954.683903493@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit 6f41c34d69eb005e7848716bbcafc979b35037d5 upstream. The machine check idtentry uses an indirect branch directly from the low level code. This evades the speculation protection. Replace it by a direct call into C code and issue the indirect call there so the compiler can apply the proper speculation protection. Signed-off-by: Thomas Gleixner Reviewed-by:Borislav Petkov Reviewed-by: David Woodhouse Niced-by: Peter Zijlstra Link: https://lkml.kernel.org/r/alpine.DEB.2.20.1801181626290.1847@nanos Signed-off-by: Greg Kroah-Hartman --- arch/x86/entry/entry_64.S | 2 +- arch/x86/include/asm/traps.h | 1 + arch/x86/kernel/cpu/mcheck/mce.c | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -1258,7 +1258,7 @@ idtentry async_page_fault do_async_page_ #endif #ifdef CONFIG_X86_MCE -idtentry machine_check has_error_code=0 paranoid=1 do_sym=*machine_check_vector(%rip) +idtentry machine_check do_mce has_error_code=0 paranoid=1 #endif /* --- a/arch/x86/include/asm/traps.h +++ b/arch/x86/include/asm/traps.h @@ -88,6 +88,7 @@ dotraplinkage void do_simd_coprocessor_e #ifdef CONFIG_X86_32 dotraplinkage void do_iret_error(struct pt_regs *, long); #endif +dotraplinkage void do_mce(struct pt_regs *, long); static inline int get_si_code(unsigned long condition) { --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c @@ -1788,6 +1788,11 @@ static void unexpected_machine_check(str void (*machine_check_vector)(struct pt_regs *, long error_code) = unexpected_machine_check; +dotraplinkage void do_mce(struct pt_regs *regs, long error_code) +{ + machine_check_vector(regs, error_code); +} + /* * Called for each booted CPU to set up machine checks. * Must be called with preempt off: