Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 258032
b: refs/heads/master
c: e57d4a3
h: refs/heads/master
v: v3
  • Loading branch information
Yang, Wei Y authored and Avi Kivity committed Jul 12, 2011
1 parent f692a3c commit bf2c609
Show file tree
Hide file tree
Showing 2 changed files with 9 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: 611c120f7486a19e7df2225f875a52ef0b599ae8
refs/heads/master: e57d4a356ad3ac46881399c424cc6cf6dd16359d
9 changes: 8 additions & 1 deletion trunk/arch/x86/kvm/paging_tmpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
gfn_t gfn;
u32 ac;

/* check if the kernel is fetching from user page */
if (unlikely(pte_access & PT_USER_MASK) &&
kvm_read_cr4_bits(vcpu, X86_CR4_SMEP))
if (fetch_fault && !user_fault)
eperm = true;

gfn = gpte_to_gfn_lvl(pte, lvl);
gfn += (addr & PT_LVL_OFFSET_MASK(lvl)) >> PAGE_SHIFT;

Expand Down Expand Up @@ -305,7 +311,8 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,

walker->fault.error_code |= write_fault | user_fault;

if (fetch_fault && mmu->nx)
if (fetch_fault && (mmu->nx ||
kvm_read_cr4_bits(vcpu, X86_CR4_SMEP)))
walker->fault.error_code |= PFERR_FETCH_MASK;
if (rsvd_fault)
walker->fault.error_code |= PFERR_RSVD_MASK;
Expand Down

0 comments on commit bf2c609

Please sign in to comment.