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: <20201112004606.48c339a6.zkaspar82@gmail.com>
Date:   Thu, 12 Nov 2020 00:46:06 +0100
From:   Zdenek Kaspar <zkaspar82@...il.com>
To:     Ben Gardon <bgardon@...gle.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Sean Christopherson <sean.j.christopherson@...el.com>,
        Peter Shier <pshier@...gle.com>,
        Jim Mattson <jmattson@...gle.com>
Subject: Re: [PATCH] kvm: x86/mmu: Fix is_tdp_mmu_check when using PAE

On Wed, 11 Nov 2020 10:53:37 -0800
Ben Gardon <bgardon@...gle.com> wrote:

> When PAE is in use, the root_hpa will not have a shadow page
> assoicated with it. In this case the kernel will crash with a NULL
> pointer dereference. Add checks to ensure is_tdp_mmu_root works as
> intended even when using PAE.
> 
> Tested: compiles
> 
> Fixes: 02c00b3a2f7e ("kvm: x86/mmu: Allocate and free TDP MMU roots")
> Reported-by: Zdenek Kaspar <zkaspar82@...il.com>
> Signed-off-by: Ben Gardon <bgardon@...gle.com>
> ---
>  arch/x86/kvm/mmu/tdp_mmu.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
> index 27e381c9da6c..13013f4d98ad 100644
> --- a/arch/x86/kvm/mmu/tdp_mmu.c
> +++ b/arch/x86/kvm/mmu/tdp_mmu.c
> @@ -49,8 +49,18 @@ bool is_tdp_mmu_root(struct kvm *kvm, hpa_t hpa)
>  {
>  	struct kvm_mmu_page *sp;
>  
> +	if (WARN_ON(!VALID_PAGE(hpa)))
> +		return false;
> +
>  	sp = to_shadow_page(hpa);
>  
> +	/*
> +	 * If this VM is being run with PAE, the TDP MMU will not be
> enabled
> +	 * and the root HPA will not have a shadow page associated
> with it.
> +	 */
> +	if (!sp)
> +		return false;
> +
>  	return sp->tdp_mmu_page && sp->root_count;
>  }
>  

Fixes is_tdp_mmu_root NULL pointer dereference
Tested on: Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz

Tested-by: Zdenek Kaspar <zkaspar82@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ