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] [day] [month] [year] [list]
Date:	Tue, 14 Apr 2015 10:14:34 -0700
From:	Andres Lagar-Cavilla <andreslc@...gle.com>
To:	Wanpeng Li <wanpeng.li@...ux.intel.com>
Cc:	Paolo Bonzini <pbonzini@...hat.com>,
	Xiao Guangrong <guangrong.xiao@...ux.intel.com>,
	Eric Northup <digitaleric@...gle.com>, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kvm: mmu: don't do overflow memslot check

On Mon, Apr 13, 2015 at 10:51 PM, Wanpeng Li <wanpeng.li@...ux.intel.com> wrote:
> As Andre pointed out:
(Andres)
>
> | I don't understand the value of this check here. Are we looking for a
> | broken memslot? Shouldn't this be a BUG_ON? Is this the place to care
> | about these things? npages is capped to KVM_MEM_MAX_NR_PAGES, i.e.
> | 2^31. A 64 bit overflow would be caused by a gigantic gfn_start which
> | would be trouble in many other ways.
>
> This patch drops the memslot overflow check to make the codes more simple.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@...ux.intel.com>
Reviewed-by: Andres Lagar-Cavilla <andreslc@...gle.com>

Thanks
> ---
>  arch/x86/kvm/mmu.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 2a0d77e..9265fda 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -4505,19 +4505,12 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
>         bool flush = false;
>         unsigned long *rmapp;
>         unsigned long last_index, index;
> -       gfn_t gfn_start, gfn_end;
>
>         spin_lock(&kvm->mmu_lock);
>
> -       gfn_start = memslot->base_gfn;
> -       gfn_end = memslot->base_gfn + memslot->npages - 1;
> -
> -       if (gfn_start >= gfn_end)
> -               goto out;
> -
>         rmapp = memslot->arch.rmap[0];
> -       last_index = gfn_to_index(gfn_end, memslot->base_gfn,
> -                                       PT_PAGE_TABLE_LEVEL);
> +       last_index = gfn_to_index(memslot->base_gfn + memslot->npages - 1,
> +                               memslot->base_gfn, PT_PAGE_TABLE_LEVEL);
>
>         for (index = 0; index <= last_index; ++index, ++rmapp) {
>                 if (*rmapp)
> @@ -4535,7 +4528,6 @@ void kvm_mmu_zap_collapsible_sptes(struct kvm *kvm,
>         if (flush)
>                 kvm_flush_remote_tlbs(kvm);
>
> -out:
>         spin_unlock(&kvm->mmu_lock);
>  }
>
> --
> 1.9.1
>



-- 
Andres Lagar-Cavilla | Google Kernel Team | andreslc@...gle.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ