From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750815AbdAWI3Q (ORCPT ); Mon, 23 Jan 2017 03:29:16 -0500 Received: from terminus.zytor.com ([65.50.211.136]:33254 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbdAWI3P (ORCPT ); Mon, 23 Jan 2017 03:29:15 -0500 Date: Mon, 23 Jan 2017 00:28:03 -0800 From: tip-bot for Kevin Hao Message-ID: Cc: oleg@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, dvlasenk@redhat.com, fenghua.yu@intel.com, bp@alien8.de, jpoimboe@redhat.com, riel@redhat.com, torvalds@linux-foundation.org, quentin.casasnovas@oracle.com, hpa@zytor.com, haokexin@gmail.com, tglx@linutronix.de, yu-cheng.yu@intel.com, luto@kernel.org, brgerst@gmail.com, dave.hansen@linux.intel.com Reply-To: fenghua.yu@intel.com, dvlasenk@redhat.com, peterz@infradead.org, oleg@redhat.com, mingo@kernel.org, linux-kernel@vger.kernel.org, brgerst@gmail.com, yu-cheng.yu@intel.com, luto@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, jpoimboe@redhat.com, haokexin@gmail.com, hpa@zytor.com, quentin.casasnovas@oracle.com, tglx@linutronix.de, torvalds@linux-foundation.org, riel@redhat.com In-Reply-To: <1485075023-30161-1-git-send-email-haokexin@gmail.com> References: <1485075023-30161-1-git-send-email-haokexin@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/fpu: Set the xcomp_bv when we fake up a XSAVES area Git-Commit-ID: 5fa356458b5c918bdf8307b070a3d74bc015d910 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: 5fa356458b5c918bdf8307b070a3d74bc015d910 Gitweb: http://git.kernel.org/tip/5fa356458b5c918bdf8307b070a3d74bc015d910 Author: Kevin Hao AuthorDate: Sun, 22 Jan 2017 16:50:23 +0800 Committer: Ingo Molnar CommitDate: Mon, 23 Jan 2017 09:03:03 +0100 x86/fpu: Set the xcomp_bv when we fake up a XSAVES area I got the following calltrace on a Apollo Lake SoC with 32-bit kernel: WARNING: CPU: 2 PID: 261 at arch/x86/include/asm/fpu/internal.h:363 fpu__restore+0x1f5/0x260 [...] Hardware name: Intel Corp. Broxton P/NOTEBOOK, BIOS APLIRVPA.X64.0138.B35.1608091058 08/09/2016 Call Trace: dump_stack() __warn() ? fpu__restore() warn_slowpath_null() fpu__restore() __fpu__restore_sig() fpu__restore_sig() restore_sigcontext.isra.9() sys_sigreturn() do_int80_syscall_32() entry_INT80_32() The reason is that a #GP occurs when executing XRSTORS. The root cause is that we forget to set the xcomp_bv when we fake up the XSAVES area in the copyin_to_xsaves() function. Signed-off-by: Kevin Hao Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Dave Hansen Cc: Denys Vlasenko Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Josh Poimboeuf Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Quentin Casasnovas Cc: Rik van Riel Cc: Thomas Gleixner Cc: Yu-cheng Yu Link: http://lkml.kernel.org/r/1485075023-30161-1-git-send-email-haokexin@gmail.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/xstate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c index 1d77704..e287b90 100644 --- a/arch/x86/kernel/fpu/xstate.c +++ b/arch/x86/kernel/fpu/xstate.c @@ -1070,6 +1070,7 @@ int copyin_to_xsaves(const void *kbuf, const void __user *ubuf, * Add back in the features that came in from userspace: */ xsave->header.xfeatures |= xfeatures; + xsave->header.xcomp_bv = XCOMP_BV_COMPACTED_FORMAT | xsave->header.xfeatures; return 0; }