From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750807AbdAWJpC (ORCPT ); Mon, 23 Jan 2017 04:45:02 -0500 Received: from terminus.zytor.com ([65.50.211.136]:36292 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750705AbdAWJpB (ORCPT ); Mon, 23 Jan 2017 04:45:01 -0500 Date: Mon, 23 Jan 2017 01:43:00 -0800 From: tip-bot for Kevin Hao Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, fenghua.yu@intel.com, jpoimboe@redhat.com, haokexin@gmail.com, mingo@kernel.org, luto@kernel.org, yu-cheng.yu@intel.com, riel@redhat.com, dave.hansen@linux.intel.com, bp@alien8.de, brgerst@gmail.com, dvlasenk@redhat.com, linux-kernel@vger.kernel.org, oleg@redhat.com, torvalds@linux-foundation.org, tglx@linutronix.de, quentin.casasnovas@oracle.com Reply-To: brgerst@gmail.com, bp@alien8.de, tglx@linutronix.de, quentin.casasnovas@oracle.com, oleg@redhat.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, dvlasenk@redhat.com, mingo@kernel.org, haokexin@gmail.com, hpa@zytor.com, fenghua.yu@intel.com, jpoimboe@redhat.com, peterz@infradead.org, riel@redhat.com, yu-cheng.yu@intel.com, dave.hansen@linux.intel.com, luto@kernel.org 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: 4c833368f0bf748d4147bf301b1f95bc8eccb3c0 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: 4c833368f0bf748d4147bf301b1f95bc8eccb3c0 Gitweb: http://git.kernel.org/tip/4c833368f0bf748d4147bf301b1f95bc8eccb3c0 Author: Kevin Hao AuthorDate: Sun, 22 Jan 2017 16:50:23 +0800 Committer: Thomas Gleixner CommitDate: Mon, 23 Jan 2017 10:40:18 +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 Signed-off-by: Thomas Gleixner --- 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; }