Skip to contentSkip to conversation

check shadow_pte == NULL in FNAME(page_fault); drivers/kvm/paging_tmpl.h

PATCH In review Roel Kluin 2 participants 2 messages Nov 16, 2007 – Nov 18, 2007 1 message not in the archive KVM

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 check shadow_pte == NULL in FNAME(page_fault); drivers/kvm/paging_tmpl.h

#------------------------------------------------------------------------------#
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,

---

drivers/kvm/paging_tmpl.h +1 -1
index 4b5391c..fce305d 100644
@@ -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/

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 10 lines · Roel Kluin

#------------------------------------------------------------------------------#
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.

Signature · 7 lines
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/