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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <62dd03f0-4049-1d9c-d07b-61cac4c49c93@redhat.com>
Date:   Mon, 18 Sep 2017 14:19:26 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Yu Zhang <yu.c.zhang@...ux.intel.com>, kvm@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, pbonzini@...hat.com,
        jmattson@...gle.com, rkrcmar@...hat.com, tglx@...utronix.de,
        mingo@...hat.com, hpa@...or.com
Subject: Re: [PATCH] KVM: x86: Fix the NULL pointer parameter in
 check_cr_write()

On 18.09.2017 12:45, Yu Zhang wrote:
> Routine check_cr_write() will trigger emulator_get_cpuid()->
> kvm_cpuid() to get maxphyaddr, and NULL is passed as values
> for ebx/ecx/edx. This is problematic because kvm_cpuid() will
> dereference these pointers.
> 
> Fixes: d1cd3ce90044 ("KVM: MMU: check guest CR3 reserved bits based on its physical address width.")
> Reported-by: Jim Mattson <jmattson@...gle.com>
> Signed-off-by: Yu Zhang <yu.c.zhang@...ux.intel.com>
> ---
>  arch/x86/kvm/emulate.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 16bf665..15f527b 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -4102,10 +4102,12 @@ static int check_cr_write(struct x86_emulate_ctxt *ctxt)
>  		ctxt->ops->get_msr(ctxt, MSR_EFER, &efer);
>  		if (efer & EFER_LMA) {
>  			u64 maxphyaddr;
> -			u32 eax = 0x80000008;
> +			u32 eax, ebx, ecx, edx;
>  
> -			if (ctxt->ops->get_cpuid(ctxt, &eax, NULL, NULL,
> -						 NULL, false))
> +			eax = 0x80000008;
> +			ecx = 0;
> +			if (ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx,
> +						 &edx, false))
>  				maxphyaddr = eax & 0xff;
>  			else
>  				maxphyaddr = 36;
> 

Not sure if fixing kvm_cpuid() would be better.

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

-- 

Thanks,

David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ