public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] check shadow_pte == NULL in FNAME(page_fault); drivers/kvm/paging_tmpl.h
@ 2007-11-16 20:55 Roel Kluin
       [not found] ` <473E03AC.3000403-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2007-11-16 20:55 UTC (permalink / raw)
  To: avi-atKUWr5tajBWk0Htik3J/w; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

#------------------------------------------------------------------------------#
in function FNAME(page_fault), drivers/kvm/paging_tmpl.h, line 450, (linus' git)

I think a check is in place. I am not sure whether this is how it should be
done, nor was the patch below tested. So please review.
--
The u64 pointer shadow_pte is initialized by the function FNAME(fetch), but
FNAME(fetch) can return NULL,

Signed-off-by: Roel Kluin <12o3l-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
---
diff --git a/drivers/kvm/paging_tmpl.h b/drivers/kvm/paging_tmpl.h
index 4b5391c..fce305d 100644
--- a/drivers/kvm/paging_tmpl.h
+++ b/drivers/kvm/paging_tmpl.h
@@ -460,7 +460,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
 	/*
 	 * mmio: emulate if accessible, otherwise its a guest fault.
 	 */
-	if (is_io_pte(*shadow_pte))
+	if (!shadow_pte || is_io_pte(*shadow_pte))
 		return 1;
 
 	++vcpu->stat.pf_fixed;

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] check shadow_pte == NULL in FNAME(page_fault); drivers/kvm/paging_tmpl.h
       [not found] ` <473E03AC.3000403-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
@ 2007-11-18 11:02   ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2007-11-18 11:02 UTC (permalink / raw)
  To: Roel Kluin; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Roel Kluin wrote:
> #------------------------------------------------------------------------------#
> in function FNAME(page_fault), drivers/kvm/paging_tmpl.h, line 450, (linus' git)
>
> I think a check is in place. I am not sure whether this is how it should be
> done, nor was the patch below tested. So please review.
> --
> The u64 pointer shadow_pte is initialized by the function FNAME(fetch), but
> FNAME(fetch) can return NULL,
>
>   

It cannot; if walker->pte is not present we bail out sooner.  See the 
check immediately before the call to FNAME(fetch).  

The check in FNAME(fetch) is dead code.

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-11-18 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16 20:55 [PATCH] check shadow_pte == NULL in FNAME(page_fault); drivers/kvm/paging_tmpl.h Roel Kluin
     [not found] ` <473E03AC.3000403-IWqWACnzNjzz+pZb47iToQ@public.gmane.org>
2007-11-18 11:02   ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox