From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x226a4KjmNh3Hoqt7V73x6uwWNnrwlixYYHbIsof8rMptySPq1FXM1rVoa+/Q8mKvpGBaEWv/ ARC-Seal: i=1; a=rsa-sha256; t=1516610958; cv=none; d=google.com; s=arc-20160816; b=DC1LpKYqABINODufmmJWY3T00TK9dZsZL3vuEA/nZJh2+GehTObdQbjK4SfaSd2YOC ya60icYhEtGNduZ9HresKhVZkVFXKoIrNhqHDTBDUX09Fs6U18aPxdQen2dZFV8YPihV vEp8a0qhB+w/5fQ8flfyxU0VbtDLtPu72nOE2tUwYfmWNWqS0+hcLsd/V5P5lU9UcAyN l6+fhsuewYjN1WkCvim7Dvc1m0yMG0EaZxhcQWb2lHMGOfe5rmmz4hNdcUALwSlZGkG2 w139co43/GPBVAPS8xZigLxwYy/vN1o5AbfPL5wTvpZ06yiWPTrptz0U52X6j+Vt4xiE 5VTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=nG22sAlFXCSFfEm/x6RThKrvobvD6FoLRxlwG5T/A9M=; b=SBIenb/P/85wf9KTQb5xHvl5am4OQv3ppJi/jRmSj5eHOADbmfBKwHXE6ekT4dMMov 5/XjC5LPtyq7otWgQ/UpCek1s6P0GHPMWiJ1m4lCosAwrlCxFTR8kmXCDLpFyFLostts 9nkAN4ppv9aVRpSe/rV5hVLm06UBDFpBJv/aJGZg0OCJwAkZunIOr+dohiAkvzCrA9/d x2B8u3JmpPzUD278PCyARV9/5rqmwjZ8BwmOIIXHS/pftKkruwVk3yFvV3YH+UE82lFL ziDEI/rkoMku7UKTEXWbRfBL3/4Vlgxo8qitWsdkDI2deximyQmY2h8ghvE7+JZb8d2S kYsw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org 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.9 42/47] x86/mce: Make machine check speculation protected Date: Mon, 22 Jan 2018 09:45:53 +0100 Message-Id: <20180122083928.690784525@linuxfoundation.org> X-Mailer: git-send-email 2.16.0 In-Reply-To: <20180122083925.568134913@linuxfoundation.org> References: <20180122083925.568134913@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590281435968326402?= X-GMAIL-MSGID: =?utf-8?q?1590281852630413296?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.9-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 @@ -1064,7 +1064,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 @@ -92,6 +92,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 @@ -1754,6 +1754,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: