From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753336AbbGEIfw (ORCPT ); Sun, 5 Jul 2015 04:35:52 -0400 Received: from terminus.zytor.com ([198.137.202.10]:35002 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753009AbbGEIfQ (ORCPT ); Sun, 5 Jul 2015 04:35:16 -0400 Date: Sat, 4 Jul 2015 01:09:34 -0700 From: tip-bot for Ingo Molnar Message-ID: Cc: tglx@linutronix.de, torvalds@linux-foundation.org, luto@amacapital.net, dvlasenk@redhat.com, oleg@redhat.com, mingo@kernel.org, jack@suse.cz, bp@alien8.de, brgerst@gmail.com, dave.hansen@linux.intel.com, hpa@zytor.com, fenghua.yu@intel.com, peterz@infradead.org, linux-kernel@vger.kernel.org, quentin.casasnovas@oracle.com Reply-To: hpa@zytor.com, fenghua.yu@intel.com, dave.hansen@linux.intel.com, quentin.casasnovas@oracle.com, linux-kernel@vger.kernel.org, peterz@infradead.org, bp@alien8.de, jack@suse.cz, brgerst@gmail.com, mingo@kernel.org, torvalds@linux-foundation.org, luto@amacapital.net, tglx@linutronix.de, oleg@redhat.com, dvlasenk@redhat.com In-Reply-To: <20150704075819.GA9201@gmail.com> References: <20150704075819.GA9201@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/fpu: Fix boot crash in the early FPU code Git-Commit-ID: b96fecbfa8c88b057e2bbf10021521c232bb3650 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: b96fecbfa8c88b057e2bbf10021521c232bb3650 Gitweb: http://git.kernel.org/tip/b96fecbfa8c88b057e2bbf10021521c232bb3650 Author: Ingo Molnar AuthorDate: Sat, 4 Jul 2015 09:58:19 +0200 Committer: Ingo Molnar CommitDate: Sat, 4 Jul 2015 10:05:56 +0200 x86/fpu: Fix boot crash in the early FPU code Jan Kara and Thomas Gleixner reported boot crashes in the FPU code: general protection fault: 0000 [#1] SMP RIP: 0010:[] [] mxcsr_feature_mask_init+0x1c/0x40 2b:* 0f ae 85 00 fe ff ff fxsave -0x200(%rbp) and bisected it down to the following FPU commit: 91a8c2a5b43f ("x86/fpu: Clean up and fix MXCSR handling") The reason is that the on-stack FPU registers state variable, used by the FXSAVE instruction, did not have the required minimum alignment of 16 bytes, causing the general protection fault. This is most likely a GCC bug in older GCC versions, but the offending commit also added a bogus extra 32-byte alignment (which GCC ignored too). So fix this bug by making the variable static again, but also mark it __initdata this time, because fpu__init_system_mxcsr() is now an __init function. Reported-and-bisected-by: Jan Kara Reported-bisected-and-tested-by: Thomas Gleixner Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Jan Kara Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Quentin Casasnovas Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/20150704075819.GA9201@gmail.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/init.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/fpu/init.c b/arch/x86/kernel/fpu/init.c index fc878fe..3282679 100644 --- a/arch/x86/kernel/fpu/init.c +++ b/arch/x86/kernel/fpu/init.c @@ -95,11 +95,12 @@ static void __init fpu__init_system_mxcsr(void) unsigned int mask = 0; if (cpu_has_fxsr) { - struct fxregs_state fx_tmp __aligned(32) = { }; + /* Static because GCC does not get 16-byte stack alignment right: */ + static struct fxregs_state fxregs __initdata; - asm volatile("fxsave %0" : "+m" (fx_tmp)); + asm volatile("fxsave %0" : "+m" (fxregs)); - mask = fx_tmp.mxcsr_mask; + mask = fxregs.mxcsr_mask; /* * If zero then use the default features mask,