mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Nicholas Krause <xerofoify@gmail.com>, gleb@kernel.org
Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm:x86:Call BUG_ON marco if calls to x86_set_memory_region fail in kvm_arch_destroy
Date: Fri, 7 Aug 2015 10:54:33 +0200	[thread overview]
Message-ID: <55C47249.1020308@redhat.com> (raw)
In-Reply-To: <1438870421-26825-1-git-send-email-xerofoify@gmail.com>



On 06/08/2015 16:13, Nicholas Krause wrote:
> This fixes the calls to x86_memory_region to trigger a kernel
> oopes for tracing if a bug arises in the function kvm_arch_destroy
> due to the failing of any of its internal calls to x86_set_memory_region.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
>  arch/x86/kvm/x86.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 5ef2560..3866cf3 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7745,6 +7745,7 @@ EXPORT_SYMBOL_GPL(x86_set_memory_region);
>  
>  void kvm_arch_destroy_vm(struct kvm *kvm)
>  {
> +	int ret;
>  	if (current->mm == kvm->mm) {
>  		/*
>  		 * Free memory regions allocated on behalf of userspace,
> @@ -7754,13 +7755,16 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
>  		struct kvm_userspace_memory_region mem;
>  		memset(&mem, 0, sizeof(mem));
>  		mem.slot = APIC_ACCESS_PAGE_PRIVATE_MEMSLOT;
> -		x86_set_memory_region(kvm, &mem);
> +		ret = x86_set_memory_region(kvm, &mem);
> +		BUG_ON(ret);
>  
>  		mem.slot = IDENTITY_PAGETABLE_PRIVATE_MEMSLOT;
> -		x86_set_memory_region(kvm, &mem);
> +		ret = x86_set_memory_region(kvm, &mem);
> +		BUG_ON(ret);
>  
>  		mem.slot = TSS_PRIVATE_MEMSLOT;
> -		x86_set_memory_region(kvm, &mem);
> +		ret = x86_set_memory_region(kvm, &mem);
> +		BUG_ON(ret);
>  	}
>  	kvm_iommu_unmap_guest(kvm);
>  	kfree(kvm->arch.vpic);
> 

No, not at all!  Leaking 12k of RAM is not a reason to crash the
machine.  WARN_ON would be acceptable.

Paolo

           reply	other threads:[~2015-08-07  8:54 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1438870421-26825-1-git-send-email-xerofoify@gmail.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C47249.1020308@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xerofoify@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®