Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1263857 > unrolled thread

[PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM

Started byHuaitong Han <huaitong.han@intel.com>
First post2015-11-06 10:10 +0100
Last post2015-11-12 14:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM Huaitong Han <huaitong.han@intel.com> - 2015-11-06 10:10 +0100
    Re: [PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer  to KVM Dave Hansen <dave.hansen@intel.com> - 2015-11-10 23:50 +0100
    [tip:x86/urgent] x86/fpu: Fix get_xsave_addr()   behavior under virtualization tip-bot for Huaitong Han <tipbot@zytor.com> - 2015-11-12 14:30 +0100

#1263857 — [PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM

FromHuaitong Han <huaitong.han@intel.com>
Date2015-11-06 10:10 +0100
Subject[PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM
Message-ID<qrLbY-2xT-21@gated-at.bofh.it>
when KVM uses the get_xsave_addr, xsave parameter belongs to guest vcpu, if
xsave is replaced with current task (host) xsave, get_xsave_addr will return error
xsave addr to KVM.

Signed-off-by: Huaitong Han <huaitong.han@intel.com>
---
 arch/x86/kernel/fpu/xstate.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 62fc001..2c4ac07 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -402,7 +402,6 @@ void *get_xsave_addr(struct xregs_state *xsave, int xstate_feature)
 	if (!boot_cpu_has(X86_FEATURE_XSAVE))
 		return NULL;
 
-	xsave = &current->thread.fpu.state.xsave;
 	/*
 	 * We should not ever be requesting features that we
 	 * have not enabled.  Remember that pcntxt_mask is
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1266833 — Re: [PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM

FromDave Hansen <dave.hansen@intel.com>
Date2015-11-10 23:50 +0100
SubjectRe: [PATCH] x86/fpu: Fix get_xsave_addr which returns error pointer to KVM
Message-ID<qtpTH-2Jl-19@gated-at.bofh.it>
In reply to#1263857
On 11/06/2015 01:00 AM, Huaitong Han wrote:
> when KVM uses the get_xsave_addr, xsave parameter belongs to guest vcpu, if
> xsave is replaced with current task (host) xsave, get_xsave_addr will return error
> xsave addr to KVM.
> 
> Signed-off-by: Huaitong Han <huaitong.han@intel.com>

Looks good to me.  It was completely bogus that we passed 'xsave' in
there and then just wrote over it.

Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1267914 — [tip:x86/urgent] x86/fpu: Fix get_xsave_addr() behavior under virtualization

Fromtip-bot for Huaitong Han <tipbot@zytor.com>
Date2015-11-12 14:30 +0100
Subject[tip:x86/urgent] x86/fpu: Fix get_xsave_addr() behavior under virtualization
Message-ID<qu06S-ZA-25@gated-at.bofh.it>
In reply to#1263857
Commit-ID:  a05917b6ba9dc9a95fc42bdcbe3a875e8ad83935
Gitweb:     http://git.kernel.org/tip/a05917b6ba9dc9a95fc42bdcbe3a875e8ad83935
Author:     Huaitong Han <huaitong.han@intel.com>
AuthorDate: Fri, 6 Nov 2015 17:00:23 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 12 Nov 2015 09:34:58 +0100

x86/fpu: Fix get_xsave_addr() behavior under virtualization

KVM uses the get_xsave_addr() function in a different fashion from
the native kernel, in that the 'xsave' parameter belongs to guest vcpu,
not the currently running task.

But 'xsave' is replaced with current task's (host) xsave structure, so
get_xsave_addr() will incorrectly return the bad xsave address to KVM.

Fix it so that the passed in 'xsave' address is used - as intended
originally.

Signed-off-by: Huaitong Han <huaitong.han@intel.com>
Reviewed-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: <stable@vger.kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: dave.hansen@intel.com
Link: http://lkml.kernel.org/r/1446800423-21622-1-git-send-email-huaitong.han@intel.com
[ Tidied up the changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/fpu/xstate.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/xstate.c b/arch/x86/kernel/fpu/xstate.c
index 6454f27..70fc312 100644
--- a/arch/x86/kernel/fpu/xstate.c
+++ b/arch/x86/kernel/fpu/xstate.c
@@ -694,7 +694,6 @@ void *get_xsave_addr(struct xregs_state *xsave, int xstate_feature)
 	if (!boot_cpu_has(X86_FEATURE_XSAVE))
 		return NULL;
 
-	xsave = &current->thread.fpu.state.xsave;
 	/*
 	 * We should not ever be requesting features that we
 	 * have not enabled.  Remember that pcntxt_mask is
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web