On 11/21/2012 06:27 AM, Marcelo Tosatti wrote:

>> @@ -544,6 +544,21 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, 
>> gva_t addr, u32 error_code,
>>              return 0;
>>      }
>>
>> +    if (write_fault && !(walker.pte_access & ACC_WRITE_MASK) &&
>> +          !is_write_protection(vcpu) && !user_fault) {
>> +            walker.pte_access |= ACC_WRITE_MASK;
>> +            walker.pte_access &= ~ACC_USER_MASK;
>> +
>> +            /*
>> +             * If we converted a user page to a kernel page,
>> +             * so that the kernel can write to it when cr0.wp=0,
>> +             * then we should prevent the kernel from executing it
>> +             * if SMEP is enabled.
>> +             */
>> +            if (kvm_read_cr4_bits(vcpu, X86_CR4_SMEP))
>> +                    walker.pte_access &= ~ACC_EXEC_MASK;
>> +    }
>> +
> 
> What about sync_page path?

The sync_page and other prefetch paths only do read-prefetch, means
they call set_spte with write_fault = 0.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to