lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871rhl2w4w.fsf@vitty.brq.redhat.com>
Date:   Mon, 26 Oct 2020 10:07:27 +0100
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Peter Xu <peterx@...hat.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Cc:     peterx@...hat.com,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Steffen Dirkwinkel <kernel-bugs@...ffen.cc>
Subject: Re: [PATCH 2/2] KVM: X86: Fix null pointer reference for KVM_GET_MSRS

Peter Xu <peterx@...hat.com> writes:

> kvm_msr_ignored_check() could trigger a null pointer reference

'dereference' but I'd also clarify that 'vcpu' is NULL.

>  if ignore_msrs=Y
> and report_ignore_msrs=Y when try to fetch an invalid feature msr using the
> global KVM_GET_MSRS.  Degrade the error report to not rely on vcpu since that
> information (index, rip) is not as important as msr index/data after all.
>
> Fixes: 12bc2132b15e0a96

Fixes: 12bc2132b15e ("KVM: X86: Do the same ignore_msrs check for feature msrs")

please (checkpatch.pl should've complained I guess)

> Reported-by: Steffen Dirkwinkel <kernel-bugs@...ffen.cc>
> Signed-off-by: Peter Xu <peterx@...hat.com>
> ---
>  arch/x86/kvm/x86.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ce856e0ece84..5993fbd6d2c5 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -259,8 +259,8 @@ static int kvm_msr_ignored_check(struct kvm_vcpu *vcpu, u32 msr,
>  
>  	if (ignore_msrs) {
>  		if (report_ignored_msrs)
> -			vcpu_unimpl(vcpu, "ignored %s: 0x%x data 0x%llx\n",
> -				    op, msr, data);
> +			kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n",
> +				      op, msr, data);

I would've preserved vcpu version for non-gloal cases, e.g.

if (report_ignored_msrs) {
	if (vcpu)
        	vcpu_unimpl(vcpu, "ignored %s: 0x%x data 0x%llx\n",
	                op, msr, data);
        else
	        kvm_pr_unimpl("ignored %s: 0x%x data 0x%llx\n",
                               op, msr, data);
}

>  		/* Mask the error */
>  		return 0;
>  	} else {

-- 
Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ