Re: [PATCH v5 07/14] nEPT: Add EPT tables support to paging_tmpl.h

Gleb Natapov
2013-08-01T07:43:33Z

On Thu, Aug 01, 2013 at 03:31:01PM +0800, Xiao Guangrong wrote:
> On 08/01/2013 03:18 PM, Xiao Guangrong wrote:
> +#endif
> >>>
> >>> Hmm, why not use shadow_x_mask, shadow_user_mask instead? PT_WRITABLE_MASK
> >>> is also suitable for ept, i guess we can remove the "#if/#else/#endif" after
> >>> that.
> >>>
> >> shadow_x_mask and shadow_user_mask do not depend on guest paging mode,
> >> so cannot be used here. Since we have to use ifdefs anyway relying on
> >> VMX_EPT_WRITABLE_MASK == PT_WRITABLE_MASK is not necessary. Makes code
> >> easier to read.
> >
> > Oh, yes, you are right.
> >
> > Reviewed-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
>
> BTW, i notice the code in mmu.c uses PT64_NX_MASK to check the permission,
> i.e:
>
> static bool need_remote_flush(u64 old, u64 new)
> {
> if (!is_shadow_present_pte(old))
> return false;
> if (!is_shadow_present_pte(new))
> return true;
> if ((old ^ new) & PT64_BASE_ADDR_MASK)
> return true;
> old ^= PT64_NX_MASK;
> new ^= PT64_NX_MASK;
> return (old & ~new & PT64_PERM_MASK) != 0;
> }
>
> It checks shadow page table and the mask is wrong one nest ept spte.
So shadow_x_mask need to be used here, correct?

--
Gleb.