public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvm: x86: i8259: return initialized data on invalid-size read
@ 2015-03-11 11:16 Petr Matousek
  2015-03-13  1:02 ` Marcelo Tosatti
  2015-03-30 14:40 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Petr Matousek @ 2015-03-11 11:16 UTC (permalink / raw)
  To: kvm, Paolo Bonzini, Marcelo Tosatti, Gleb Natapov; +Cc: nadav.amit

If data is read from PIC with invalid access size, the return data stays
uninitialized even though success is returned. 

Fix this by always initializing the data.

Signed-off-by: Petr Matousek <pmatouse@redhat.com>
Reported-by: Nadav Amit <nadav.amit@gmail.com>
---
 arch/x86/kvm/i8259.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index cc31f7c..9541ba3 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s,
 		return -EOPNOTSUPP;
 
 	if (len != 1) {
+		memset(val, 0, len);
 		pr_pic_unimpl("non byte read\n");
 		return 0;
 	}
-- 
1.7.4.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: x86: i8259: return initialized data on invalid-size read
  2015-03-11 11:16 [PATCH] kvm: x86: i8259: return initialized data on invalid-size read Petr Matousek
@ 2015-03-13  1:02 ` Marcelo Tosatti
  2015-03-30 14:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2015-03-13  1:02 UTC (permalink / raw)
  To: kvm, Paolo Bonzini, Gleb Natapov, nadav.amit

On Wed, Mar 11, 2015 at 12:16:09PM +0100, Petr Matousek wrote:
> If data is read from PIC with invalid access size, the return data stays
> uninitialized even though success is returned. 
> 
> Fix this by always initializing the data.
> 
> Signed-off-by: Petr Matousek <pmatouse@redhat.com>
> Reported-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>  arch/x86/kvm/i8259.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index cc31f7c..9541ba3 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s,
>  		return -EOPNOTSUPP;
>  
>  	if (len != 1) {
> +		memset(val, 0, len);
>  		pr_pic_unimpl("non byte read\n");
>  		return 0;
>  	}
> -- 
> 1.7.4.4

Applied, thanks.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvm: x86: i8259: return initialized data on invalid-size read
  2015-03-11 11:16 [PATCH] kvm: x86: i8259: return initialized data on invalid-size read Petr Matousek
  2015-03-13  1:02 ` Marcelo Tosatti
@ 2015-03-30 14:40 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2015-03-30 14:40 UTC (permalink / raw)
  To: kvm, Marcelo Tosatti, Gleb Natapov, nadav.amit



On 11/03/2015 12:16, Petr Matousek wrote:
> If data is read from PIC with invalid access size, the return data stays
> uninitialized even though success is returned. 
> 
> Fix this by always initializing the data.
> 
> Signed-off-by: Petr Matousek <pmatouse@redhat.com>
> Reported-by: Nadav Amit <nadav.amit@gmail.com>
> ---
>  arch/x86/kvm/i8259.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
> index cc31f7c..9541ba3 100644
> --- a/arch/x86/kvm/i8259.c
> +++ b/arch/x86/kvm/i8259.c
> @@ -507,6 +507,7 @@ static int picdev_read(struct kvm_pic *s,
>  		return -EOPNOTSUPP;
>  
>  	if (len != 1) {
> +		memset(val, 0, len);
>  		pr_pic_unimpl("non byte read\n");
>  		return 0;
>  	}
> 

Applied, thanks.

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-30 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-11 11:16 [PATCH] kvm: x86: i8259: return initialized data on invalid-size read Petr Matousek
2015-03-13  1:02 ` Marcelo Tosatti
2015-03-30 14:40 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox