From: Kevin Hao <haokexin@gmail.com>
To: x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] x86/fpu: set the xcomp_bv when we fake up a XSAVES area
Date: Sun, 22 Jan 2017 16:50:23 +0800 [thread overview]
Message-ID: <1485075023-30161-1-git-send-email-haokexin@gmail.com> (raw)
I got the following calltrace on a Apollo Lake SoC with 32bit kernel.
WARNING: CPU: 2 PID: 261 at arch/x86/include/asm/fpu/internal.h:363 fpu__restore+0x1f5/0x260
Modules linked in:
CPU: 2 PID: 261 Comm: check_hostname. Not tainted 4.10.0-rc4-next-20170120 #90
Hardware name: Intel Corp. Broxton P/NOTEBOOK, BIOS APLIRVPA.X64.0138.B35.1608091058 08/09/2016
Call Trace:
dump_stack+0x47/0x5f
__warn+0xea/0x110
? fpu__restore+0x1f5/0x260
warn_slowpath_null+0x2a/0x30
fpu__restore+0x1f5/0x260
__fpu__restore_sig+0x165/0x6b0
fpu__restore_sig+0x2f/0x50
restore_sigcontext.isra.9+0xe0/0xf0
sys_sigreturn+0xaa/0xf0
do_int80_syscall_32+0x59/0xb0
entry_INT80_32+0x2a/0x2a
EIP: 0xb77acc61
EFLAGS: 00000246 CPU: 2
EAX: 00000000 EBX: 00000003 ECX: 08151d38 EDX: 00000000
ESI: bfa9ce20 EDI: 08151d38 EBP: 0000000c ESP: bfa9cdbc
DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b
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 function copyin_to_xsaves().
Signed-off-by: Kevin Hao <haokexin@gmail.com>
---
arch/x86/kernel/fpu/xstate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 35f7024aace5..2c0df2681481 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -1071,6 +1071,8 @@ 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;
}
--
2.9.3
next reply other threads:[~2017-01-22 8:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-22 8:50 Kevin Hao [this message]
2017-01-23 8:28 ` [tip:x86/urgent] x86/fpu: Set " tip-bot for Kevin Hao
2017-01-23 15:36 ` Dave Hansen
2017-01-23 16:55 ` Yu-cheng Yu
2017-01-23 17:23 ` Dave Hansen
2017-01-23 20:57 ` Yu-cheng Yu
2017-01-23 21:10 ` Dave Hansen
2017-01-23 21:16 ` Yu-cheng Yu
2017-01-23 21:28 ` Dave Hansen
2017-01-24 0:14 ` Kevin Hao
2017-01-24 0:53 ` Dave Hansen
2017-01-24 1:50 ` Kevin Hao
2017-01-24 2:01 ` Dave Hansen
2017-01-24 2:09 ` Kevin Hao
2017-01-24 2:38 ` Dave Hansen
2017-01-24 5:18 ` Kevin Hao
2017-01-24 8:08 ` Ingo Molnar
2017-01-23 9:43 ` tip-bot for Kevin Hao
2017-02-14 16:47 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1485075023-30161-1-git-send-email-haokexin@gmail.com \
--to=haokexin@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®