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


Groups > linux.kernel > #1644783 > unrolled thread

[PATCH 2/4] KVM: x86: zero base3 of unusable segments

Started byRadim Krčmář <rkrcmar@redhat.com>
First post2017-05-18 19:40 +0200
Last post2017-05-19 15:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/4] KVM: x86: zero base3 of unusable segments Radim Krčmář <rkrcmar@redhat.com> - 2017-05-18 19:40 +0200
    Re: [PATCH 2/4] KVM: x86: zero base3 of unusable segments David Hildenbrand <david@redhat.com> - 2017-05-19 15:40 +0200

#1644783 — [PATCH 2/4] KVM: x86: zero base3 of unusable segments

FromRadim Krčmář <rkrcmar@redhat.com>
Date2017-05-18 19:40 +0200
Subject[PATCH 2/4] KVM: x86: zero base3 of unusable segments
Message-ID<tIxz4-5R2-25@gated-at.bofh.it>
Static checker noticed that base3 could be used uninitialized if the
segment was not present (useable).  Random stack values probably would
not pass VMCS entry checks.

Reported-by:  Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 1aa366163b8b ("KVM: x86 emulator: consolidate segment accessors")
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
 arch/x86/kvm/x86.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index b54125b590e8..eed8272dd52e 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -5053,6 +5053,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector,
 
 	if (var.unusable) {
 		memset(desc, 0, sizeof(*desc));
+		if (base3)
+			*base3 = 0;
 		return false;
 	}
 
-- 
2.13.0

[toc] | [next] | [standalone]


#1645606

FromDavid Hildenbrand <david@redhat.com>
Date2017-05-19 15:40 +0200
Message-ID<tIQim-2MD-11@gated-at.bofh.it>
In reply to#1644783
On 18.05.2017 19:37, Radim Krčmář wrote:
> Static checker noticed that base3 could be used uninitialized if the
> segment was not present (useable).  Random stack values probably would
> not pass VMCS entry checks.
> 
> Reported-by:  Dan Carpenter <dan.carpenter@oracle.com>
> Fixes: 1aa366163b8b ("KVM: x86 emulator: consolidate segment accessors")
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
>  arch/x86/kvm/x86.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b54125b590e8..eed8272dd52e 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -5053,6 +5053,8 @@ static bool emulator_get_segment(struct x86_emulate_ctxt *ctxt, u16 *selector,
>  
>  	if (var.unusable) {
>  		memset(desc, 0, sizeof(*desc));
> +		if (base3)
> +			*base3 = 0;
>  		return false;
>  	}
>  
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web