From: Xiaotian Feng <dfeng@redhat.com>
To: x86@kernel.org
Cc: linux-kernel@vger.kernel.org, Xiaotian Feng <dfeng@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Brian Gerst <brgerst@gmail.com>, Avi Kivity <avi@redhat.com>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH] x86: fpu xstate fix memory poison overwritten
Date: Thu, 12 Aug 2010 18:45:45 +0800 [thread overview]
Message-ID: <1281609945-2861-1-git-send-email-dfeng@redhat.com> (raw)
fpu.state is allocated from task_xstate_cachep, the size of
task_xstate_cachep is xstate_size. But fpu.state is an union
struct, which size is bigger than xstate_size if cpu_has_xsave,
so if we want to visit fpu.state->xsave, the memory we allocated
for fpu.state is not enough.
This caused many poison/redzone overwritten alerts on task_xstate while using kvm.
[ 1899.399373] =============================================================================
[ 1899.399377] BUG task_xstate: Poison overwritten
[ 1899.399378] -----------------------------------------------------------------------------
[ 1899.399379]
[ 1899.399382] INFO: 0xffff88020aca2100-0xffff88020aca217f. First byte 0x0 instead of 0x6b
[ 1899.399385] INFO: Slab 0xffffea000725c300 objects=23 used=12 fp=0xffff88020aca2100 flags=0x200000000040c1
[ 1899.399387] INFO: Object 0xffff88020aca2100 @offset=8448 fp=0xffff88020aca23c0
With this patch applied, the poison overwritten alert disappeared.
Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Avi Kivity <avi@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
arch/x86/kernel/process.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index d401f1d..609bee5 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -59,7 +59,7 @@ void free_thread_info(struct thread_info *ti)
void arch_task_cache_init(void)
{
task_xstate_cachep =
- kmem_cache_create("task_xstate", xstate_size,
+ kmem_cache_create("task_xstate", sizeof(union thread_xstate),
__alignof__(union thread_xstate),
SLAB_PANIC | SLAB_NOTRACK, NULL);
}
--
1.7.2.1
next reply other threads:[~2010-08-12 10:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-12 10:45 Xiaotian Feng [this message]
2010-08-12 11:30 ` [PATCH] x86: fpu xstate fix memory poison overwritten Brian Gerst
2010-08-13 7:19 ` [PATCH] kvm: fix poison overwritten caused by using wrong xstate size Xiaotian Feng
2010-08-13 7:56 ` Sheng Yang
2010-08-13 21:03 ` H. Peter Anvin
2010-08-15 11:05 ` Avi Kivity
2010-08-16 4:12 ` H. Peter Anvin
2010-08-15 11:08 ` Avi Kivity
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=1281609945-2861-1-git-send-email-dfeng@redhat.com \
--to=dfeng@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=avi@redhat.com \
--cc=brgerst@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;
as well as URLs for NNTP newsgroup(s).