Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 248089
b: refs/heads/master
c: 8f74d8e
h: refs/heads/master
i:
  248087: b16816d
v: v3
  • Loading branch information
Takuya Yoshikawa authored and Avi Kivity committed May 22, 2011
1 parent d472cec commit 16fc771
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b74323dc2b7b5690d18bc7934b98e4665e778a7b
refs/heads/master: 8f74d8e16812d63639871b4e56409b08bdcb66fc
16 changes: 15 additions & 1 deletion trunk/arch/x86/kvm/paging_tmpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,20 @@ static unsigned FNAME(gpte_access)(struct kvm_vcpu *vcpu, pt_element_t gpte)
return access;
}

static int FNAME(read_gpte)(pt_element_t *pte, pt_element_t __user *ptep_user)
{
#if defined(CONFIG_X86_32) && (PTTYPE == 64)
u32 *p = (u32 *)pte;
u32 __user *p_user = (u32 __user *)ptep_user;

if (unlikely(get_user(*p, p_user)))
return -EFAULT;
return get_user(*(p + 1), p_user + 1);
#else
return get_user(*pte, ptep_user);
#endif
}

/*
* Fetch a guest pte for a guest virtual address
*/
Expand Down Expand Up @@ -185,7 +199,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
}

ptep_user = (pt_element_t __user *)((void *)host_addr + offset);
if (unlikely(get_user(pte, ptep_user))) {
if (unlikely(FNAME(read_gpte)(&pte, ptep_user))) {
present = false;
break;
}
Expand Down

0 comments on commit 16fc771

Please sign in to comment.