diff mbox

[Lucid,SRU] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption

Message ID 1306265095.1548.60.camel@adamo
State New
Headers show

Pull-request

git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675

Commit Message

Leann Ogasawara May 24, 2011, 7:24 p.m. UTC
SRU Justification:

http://bugs.launchpad.net/bugs/787675

I've clearly buggered up a backported patch on Lucid that came in as an
aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
patch in question is:

    KVM: VMX: Fix host userspace gsbase corruption

    We now use load_gs_index() to load gs safely; unfortunately this also
    changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
    in confusion and breakage running 32-bit host userspace on a 64-bit kernel.

The original thread regarding this patch can be read at:

https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html

The attached patch correctly fixes up the accidental deletion of a line
of code, and correctly removes the intended line. Please apply to Lucid.
I've also built a test kernel and referenced it in the bug.  I'm hoping
for testing feedback from Jiang who originally brought the mistake to my
attention.

Thanks,
Leann

The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
  Thomas Schlichter (1):
        UBUNTU: SAUCE: vesafb: enable mtrr WC by default

are available in the git repository at:

  git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675

Leann Ogasawara (1):
      UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption

 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
From: Leann Ogasawara <leann.ogasawara@canonical.com>
Date: Tue, 24 May 2011 09:40:12 -0700
Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption

BugLink: http://bugs.launchpad.net/bugs/787675

The backport for the following commit was incorrect, eg. it removed a
line which it shouldn't have.

  commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
  Author: Avi Kivity <avi@redhat.com>
  Date:   Thu Nov 11 12:37:26 2010 +0200

    KVM: VMX: Fix host userspace gsbase corruption

Fix up the backport to be correct.

Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
---
 arch/x86/kvm/vmx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Brad Figg May 24, 2011, 7:56 p.m. UTC | #1
On 05/24/2011 12:24 PM, Leann Ogasawara wrote:
> SRU Justification:
>
> http://bugs.launchpad.net/bugs/787675
>
> I've clearly buggered up a backported patch on Lucid that came in as an
> aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
> patch in question is:
>
>      KVM: VMX: Fix host userspace gsbase corruption
>
>      We now use load_gs_index() to load gs safely; unfortunately this also
>      changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
>      in confusion and breakage running 32-bit host userspace on a 64-bit kernel.
>
> The original thread regarding this patch can be read at:
>
> https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html
>
> The attached patch correctly fixes up the accidental deletion of a line
> of code, and correctly removes the intended line. Please apply to Lucid.
> I've also built a test kernel and referenced it in the bug.  I'm hoping
> for testing feedback from Jiang who originally brought the mistake to my
> attention.
>
> Thanks,
> Leann
>
> The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
>    Thomas Schlichter (1):
>          UBUNTU: SAUCE: vesafb: enable mtrr WC by default
>
> are available in the git repository at:
>
>    git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675
>
> Leann Ogasawara (1):
>        UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
>
>   arch/x86/kvm/vmx.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
>  From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
> From: Leann Ogasawara<leann.ogasawara@canonical.com>
> Date: Tue, 24 May 2011 09:40:12 -0700
> Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
>
> BugLink: http://bugs.launchpad.net/bugs/787675
>
> The backport for the following commit was incorrect, eg. it removed a
> line which it shouldn't have.
>
>    commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
>    Author: Avi Kivity<avi@redhat.com>
>    Date:   Thu Nov 11 12:37:26 2010 +0200
>
>      KVM: VMX: Fix host userspace gsbase corruption
>
> Fix up the backport to be correct.
>
> Signed-off-by: Leann Ogasawara<leann.ogasawara@canonical.com>
> ---
>   arch/x86/kvm/vmx.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 77c3287..e3222ab 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -699,7 +699,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
>   	if (vmx->host_state.gs_ldt_reload_needed) {
>   		kvm_load_ldt(vmx->host_state.ldt_sel);
>   #ifdef CONFIG_X86_64
> -		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
> +		load_gs_index(vmx->host_state.gs_sel);
>   #else
>   		loadsegment(gs, vmx->host_state.gs_sel);
>   #endif

Acked-by: Brad Figg <brad.figg@canonical.com>
Steve Conklin May 24, 2011, 9:17 p.m. UTC | #2
On Tue, 2011-05-24 at 12:24 -0700, Leann Ogasawara wrote:
> SRU Justification:
> 
> http://bugs.launchpad.net/bugs/787675
> 
> I've clearly buggered up a backported patch on Lucid that came in as an
> aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
> patch in question is:
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
>     We now use load_gs_index() to load gs safely; unfortunately this also
>     changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
>     in confusion and breakage running 32-bit host userspace on a 64-bit kernel.
> 
> The original thread regarding this patch can be read at:
> 
> https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html
> 
> The attached patch correctly fixes up the accidental deletion of a line
> of code, and correctly removes the intended line. Please apply to Lucid.
> I've also built a test kernel and referenced it in the bug.  I'm hoping
> for testing feedback from Jiang who originally brought the mistake to my
> attention.
> 
> Thanks,
> Leann
> 
> The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
>   Thomas Schlichter (1):
>         UBUNTU: SAUCE: vesafb: enable mtrr WC by default
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675
> 
> Leann Ogasawara (1):
>       UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
> From: Leann Ogasawara <leann.ogasawara@canonical.com>
> Date: Tue, 24 May 2011 09:40:12 -0700
> Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
> BugLink: http://bugs.launchpad.net/bugs/787675
> 
> The backport for the following commit was incorrect, eg. it removed a
> line which it shouldn't have.
> 
>   commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
>   Author: Avi Kivity <avi@redhat.com>
>   Date:   Thu Nov 11 12:37:26 2010 +0200
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
> Fix up the backport to be correct.
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 77c3287..e3222ab 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -699,7 +699,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
>  	if (vmx->host_state.gs_ldt_reload_needed) {
>  		kvm_load_ldt(vmx->host_state.ldt_sel);
>  #ifdef CONFIG_X86_64
> -		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
> +		load_gs_index(vmx->host_state.gs_sel);
>  #else
>  		loadsegment(gs, vmx->host_state.gs_sel);
>  #endif
> -- 
> 1.7.0.4
> 
> 
> 


Acked-by: Steve Conklin <sconklin@canonical.com>
Herton Ronaldo Krzesinski May 24, 2011, 9:21 p.m. UTC | #3
On Tue, May 24, 2011 at 12:24:55PM -0700, Leann Ogasawara wrote:
> SRU Justification:
> 
> http://bugs.launchpad.net/bugs/787675
> 
> I've clearly buggered up a backported patch on Lucid that came in as an
> aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
> patch in question is:
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
>     We now use load_gs_index() to load gs safely; unfortunately this also
>     changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
>     in confusion and breakage running 32-bit host userspace on a 64-bit kernel.
> 
> The original thread regarding this patch can be read at:
> 
> https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html
> 
> The attached patch correctly fixes up the accidental deletion of a line
> of code, and correctly removes the intended line. Please apply to Lucid.
> I've also built a test kernel and referenced it in the bug.  I'm hoping
> for testing feedback from Jiang who originally brought the mistake to my
> attention.
> 
> Thanks,
> Leann
> 
> The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
>   Thomas Schlichter (1):
>         UBUNTU: SAUCE: vesafb: enable mtrr WC by default
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675
> 
> Leann Ogasawara (1):
>       UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
> From: Leann Ogasawara <leann.ogasawara@canonical.com>
> Date: Tue, 24 May 2011 09:40:12 -0700
> Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
> BugLink: http://bugs.launchpad.net/bugs/787675
> 
> The backport for the following commit was incorrect, eg. it removed a
> line which it shouldn't have.
> 
>   commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
>   Author: Avi Kivity <avi@redhat.com>
>   Date:   Thu Nov 11 12:37:26 2010 +0200
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
> Fix up the backport to be correct.
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>

Acked-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>

> ---
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 77c3287..e3222ab 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -699,7 +699,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
>  	if (vmx->host_state.gs_ldt_reload_needed) {
>  		kvm_load_ldt(vmx->host_state.ldt_sel);
>  #ifdef CONFIG_X86_64
> -		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
> +		load_gs_index(vmx->host_state.gs_sel);
>  #else
>  		loadsegment(gs, vmx->host_state.gs_sel);
>  #endif
> -- 
> 1.7.0.4
> 
> 
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
Steve Conklin May 24, 2011, 9:23 p.m. UTC | #4
Applied

On Tue, 2011-05-24 at 12:24 -0700, Leann Ogasawara wrote:
> SRU Justification:
> 
> http://bugs.launchpad.net/bugs/787675
> 
> I've clearly buggered up a backported patch on Lucid that came in as an
> aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
> patch in question is:
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
>     We now use load_gs_index() to load gs safely; unfortunately this also
>     changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
>     in confusion and breakage running 32-bit host userspace on a 64-bit kernel.
> 
> The original thread regarding this patch can be read at:
> 
> https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html
> 
> The attached patch correctly fixes up the accidental deletion of a line
> of code, and correctly removes the intended line. Please apply to Lucid.
> I've also built a test kernel and referenced it in the bug.  I'm hoping
> for testing feedback from Jiang who originally brought the mistake to my
> attention.
> 
> Thanks,
> Leann
> 
> The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
>   Thomas Schlichter (1):
>         UBUNTU: SAUCE: vesafb: enable mtrr WC by default
> 
> are available in the git repository at:
> 
>   git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675
> 
> Leann Ogasawara (1):
>       UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
> From: Leann Ogasawara <leann.ogasawara@canonical.com>
> Date: Tue, 24 May 2011 09:40:12 -0700
> Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase corruption
> 
> BugLink: http://bugs.launchpad.net/bugs/787675
> 
> The backport for the following commit was incorrect, eg. it removed a
> line which it shouldn't have.
> 
>   commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
>   Author: Avi Kivity <avi@redhat.com>
>   Date:   Thu Nov 11 12:37:26 2010 +0200
> 
>     KVM: VMX: Fix host userspace gsbase corruption
> 
> Fix up the backport to be correct.
> 
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> ---
>  arch/x86/kvm/vmx.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 77c3287..e3222ab 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -699,7 +699,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
>  	if (vmx->host_state.gs_ldt_reload_needed) {
>  		kvm_load_ldt(vmx->host_state.ldt_sel);
>  #ifdef CONFIG_X86_64
> -		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
> +		load_gs_index(vmx->host_state.gs_sel);
>  #else
>  		loadsegment(gs, vmx->host_state.gs_sel);
>  #endif
> -- 
> 1.7.0.4
> 
> 
> 
>
Jiang, Yunhong May 25, 2011, 8:42 a.m. UTC | #5
With this patch, the 32bit android emulator works quite well. I already update the bugzilla.
Leann, really appreciate your quick response!

Thanks
--jyh

>-----Original Message-----
>From: Leann Ogasawara [mailto:leann.ogasawara@canonical.com]
>Sent: Wednesday, May 25, 2011 3:25 AM
>To: kernel-team
>Cc: Jiang, Yunhong
>Subject: [Lucid][SRU][PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host
>userspace gsbase corruption
>
>SRU Justification:
>
>http://bugs.launchpad.net/bugs/787675
>
>I've clearly buggered up a backported patch on Lucid that came in as an
>aside for the 2.6.32.26+drm33.11 stable patch set (See bug 681132). The
>patch in question is:
>
>    KVM: VMX: Fix host userspace gsbase corruption
>
>    We now use load_gs_index() to load gs safely; unfortunately this also
>    changes MSR_KERNEL_GS_BASE, which we managed separately. This resulted
>    in confusion and breakage running 32-bit host userspace on a 64-bit kernel.
>
>The original thread regarding this patch can be read at:
>
>https://lists.ubuntu.com/archives/kernel-team/2010-November/013655.html
>
>The attached patch correctly fixes up the accidental deletion of a line
>of code, and correctly removes the intended line. Please apply to Lucid.
>I've also built a test kernel and referenced it in the bug.  I'm hoping
>for testing feedback from Jiang who originally brought the mistake to my
>attention.
>
>Thanks,
>Leann
>
>The following changes since commit 800e98aaa03cf2134fb3b1a7c11f59e93fa97c23:
>  Thomas Schlichter (1):
>        UBUNTU: SAUCE: vesafb: enable mtrr WC by default
>
>are available in the git repository at:
>
>  git://kernel.ubuntu.com/ogasawara/ubuntu-lucid.git lp787675
>
>Leann Ogasawara (1):
>      UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace gsbase
>corruption
>
> arch/x86/kvm/vmx.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>From 7766255c19171ecd6961ea9b6455d0de11245d19 Mon Sep 17 00:00:00 2001
>From: Leann Ogasawara <leann.ogasawara@canonical.com>
>Date: Tue, 24 May 2011 09:40:12 -0700
>Subject: [PATCH] UBUNTU: SAUCE: (no-up) Fix up KVM: VMX: Fix host userspace
>gsbase corruption
>
>BugLink: http://bugs.launchpad.net/bugs/787675
>
>The backport for the following commit was incorrect, eg. it removed a
>line which it shouldn't have.
>
>  commit 6cbdc7ba48dff850c233a1ea1abe87a6d0cde2dd
>  Author: Avi Kivity <avi@redhat.com>
>  Date:   Thu Nov 11 12:37:26 2010 +0200
>
>    KVM: VMX: Fix host userspace gsbase corruption
>
>Fix up the backport to be correct.
>
>Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
>---
> arch/x86/kvm/vmx.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>index 77c3287..e3222ab 100644
>--- a/arch/x86/kvm/vmx.c
>+++ b/arch/x86/kvm/vmx.c
>@@ -699,7 +699,7 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
> 	if (vmx->host_state.gs_ldt_reload_needed) {
> 		kvm_load_ldt(vmx->host_state.ldt_sel);
> #ifdef CONFIG_X86_64
>-		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
>+		load_gs_index(vmx->host_state.gs_sel);
> #else
> 		loadsegment(gs, vmx->host_state.gs_sel);
> #endif
>--
>1.7.0.4
>
>
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 77c3287..e3222ab 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -699,7 +699,7 @@  static void __vmx_load_host_state(struct vcpu_vmx *vmx)
 	if (vmx->host_state.gs_ldt_reload_needed) {
 		kvm_load_ldt(vmx->host_state.ldt_sel);
 #ifdef CONFIG_X86_64
-		wrmsrl(MSR_KERNEL_GS_BASE, current->thread.gs);
+		load_gs_index(vmx->host_state.gs_sel);
 #else
 		loadsegment(gs, vmx->host_state.gs_sel);
 #endif