public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
* Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
       [not found] ` <20171221002427.82325-1-ebiggers3@gmail.com>
@ 2017-12-21  0:30   ` Paolo Bonzini
  2017-12-21  1:02     ` Stephen Rothwell
  2017-12-21  2:45     ` Lan Tianyu
  0 siblings, 2 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-12-21  0:30 UTC (permalink / raw)
  To: Eric Biggers, kvm
  Cc: rkrcmar, tianyu.lan, christoffer.dall, x86, linux-kernel,
	syzkaller-bugs, Eric Biggers, Stephen Rothwell,
	Linux-Next Mailing List

On 21/12/2017 01:24, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google•com>
> 
> Due to a bad merge resolution between commit f29810335965 ("KVM/x86:
> Check input paging mode when cs.l is set") and commit b4ef9d4e8cb8
> ("KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs"),
> there is a case in kvm_arch_vcpu_ioctl_set_sregs() where vcpu_put() is
> not called after vcpu_get().  Fix it.
> 
> Reported-by: syzbot <syzkaller@googlegroups•com>
> Signed-off-by: Eric Biggers <ebiggers@google•com>
> ---
>  arch/x86/kvm/x86.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ea3a98196753..f4e8b5089b28 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7624,7 +7624,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>  		goto out;
>  
>  	if (kvm_valid_sregs(vcpu, sregs))
> -		return -EINVAL;
> +		goto out;
>  
>  	apic_base_msr.data = sregs->apic_base;
>  	apic_base_msr.host_initiated = true;
> 

Thanks very much Eric, that was fast!  Adding Stephen and the linux-next
mailing list to Cc.  Adding the kvm/master tree has already paid off.

Paolo

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

* Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
  2017-12-21  0:30   ` [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs() Paolo Bonzini
@ 2017-12-21  1:02     ` Stephen Rothwell
  2017-12-21  2:45     ` Lan Tianyu
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Rothwell @ 2017-12-21  1:02 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Eric Biggers, kvm, rkrcmar, tianyu.lan, christoffer.dall, x86,
	linux-kernel, syzkaller-bugs, Eric Biggers,
	Linux-Next Mailing List

Hi Paolo,

On Thu, 21 Dec 2017 01:30:30 +0100 Paolo Bonzini <pbonzini@redhat•com> wrote:
>
> On 21/12/2017 01:24, Eric Biggers wrote:
> > From: Eric Biggers <ebiggers@google•com>
> > 
> > Due to a bad merge resolution between commit f29810335965 ("KVM/x86:
> > Check input paging mode when cs.l is set") and commit b4ef9d4e8cb8
> > ("KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs"),
> > there is a case in kvm_arch_vcpu_ioctl_set_sregs() where vcpu_put() is
> > not called after vcpu_get().  Fix it.
> > 
> > Reported-by: syzbot <syzkaller@googlegroups•com>
> > Signed-off-by: Eric Biggers <ebiggers@google•com>
> > ---
> >  arch/x86/kvm/x86.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> > index ea3a98196753..f4e8b5089b28 100644
> > --- a/arch/x86/kvm/x86.c
> > +++ b/arch/x86/kvm/x86.c
> > @@ -7624,7 +7624,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
> >  		goto out;
> >  
> >  	if (kvm_valid_sregs(vcpu, sregs))
> > -		return -EINVAL;
> > +		goto out;
> >  
> >  	apic_base_msr.data = sregs->apic_base;
> >  	apic_base_msr.host_initiated = true;
> >   
> 
> Thanks very much Eric, that was fast!  Adding Stephen and the linux-next
> mailing list to Cc.  Adding the kvm/master tree has already paid off.

I will apply that as a merge fix patch for the kvm tree merge from
today.  Please remember to apply it if/when you merge the master branch
into your linux-next branch or when these trees meet in Linus' tree.
-- 
Cheers,
Stephen Rothwell

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

* Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
  2017-12-21  0:30   ` [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs() Paolo Bonzini
  2017-12-21  1:02     ` Stephen Rothwell
@ 2017-12-21  2:45     ` Lan Tianyu
  2017-12-21  9:07       ` Paolo Bonzini
  1 sibling, 1 reply; 4+ messages in thread
From: Lan Tianyu @ 2017-12-21  2:45 UTC (permalink / raw)
  To: Paolo Bonzini, Eric Biggers, kvm
  Cc: rkrcmar, christoffer.dall, x86, linux-kernel, syzkaller-bugs,
	Eric Biggers, Stephen Rothwell, Linux-Next Mailing List

On 2017年12月21日 08:30, Paolo Bonzini wrote:
> On 21/12/2017 01:24, Eric Biggers wrote:
>> From: Eric Biggers <ebiggers@google•com>
>>
>> Due to a bad merge resolution between commit f29810335965 ("KVM/x86:
>> Check input paging mode when cs.l is set") and commit b4ef9d4e8cb8
>> ("KVM: Move vcpu_load to arch-specific kvm_arch_vcpu_ioctl_set_sregs"),
>> there is a case in kvm_arch_vcpu_ioctl_set_sregs() where vcpu_put() is
>> not called after vcpu_get().  Fix it.
>>
>> Reported-by: syzbot <syzkaller@googlegroups•com>
>> Signed-off-by: Eric Biggers <ebiggers@google•com>
>> ---
>>  arch/x86/kvm/x86.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
>> index ea3a98196753..f4e8b5089b28 100644
>> --- a/arch/x86/kvm/x86.c
>> +++ b/arch/x86/kvm/x86.c
>> @@ -7624,7 +7624,7 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
>>  		goto out;
>>  
>>  	if (kvm_valid_sregs(vcpu, sregs))
>> -		return -EINVAL;
>> +		goto out;
>>  
>>  	apic_base_msr.data = sregs->apic_base;
>>  	apic_base_msr.host_initiated = true;
>>
> 
> Thanks very much Eric, that was fast!  Adding Stephen and the linux-next
> mailing list to Cc.  Adding the kvm/master tree has already paid off.
> 
> Paolo
> 

Hi Paolo:
	Should we check input sregs before loading vcpu? If input sregs is
invalid, the operation is redundant.
-- 
Best regards
Tianyu Lan

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

* Re: [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs()
  2017-12-21  2:45     ` Lan Tianyu
@ 2017-12-21  9:07       ` Paolo Bonzini
  0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2017-12-21  9:07 UTC (permalink / raw)
  To: Lan Tianyu, Eric Biggers, kvm
  Cc: rkrcmar, christoffer.dall, x86, linux-kernel, syzkaller-bugs,
	Eric Biggers, Stephen Rothwell, Linux-Next Mailing List

On 21/12/2017 03:45, Lan Tianyu wrote:
> Hi Paolo:
> 	Should we check input sregs before loading vcpu? If input sregs is
> invalid, the operation is redundant.

That would be another way to fix the conflict.  Note that the conflict
is between two different trees (kvm/master and kvm/next), so in any case
it will remain until the next merge window.

Paolo

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

end of thread, other threads:[~2017-12-21  9:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <001a1148cc3acf967c0560c7b760@google.com>
     [not found] ` <20171221002427.82325-1-ebiggers3@gmail.com>
2017-12-21  0:30   ` [PATCH linux-next] KVM: x86: don't forget vcpu_put() in kvm_arch_vcpu_ioctl_set_sregs() Paolo Bonzini
2017-12-21  1:02     ` Stephen Rothwell
2017-12-21  2:45     ` Lan Tianyu
2017-12-21  9:07       ` Paolo Bonzini

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