Re: [PATCH V4 5/7] KVM, pkeys: Add pkeys support for gva_to_gpa funcions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 06/03/2016 09:01, Xiao Guangrong wrote:
> 
> 
> On 03/05/2016 07:27 PM, Huaitong Han wrote:
>> This patch adds pkeys support for gva_to_gpa funcions.
> 
> It is not needed if you follow the approach i raised in the previous patch.

It's not needed anyway, I think.

PFERR_PK_MASK is set to CR4.PKE.  However, patch 3 sets pku to false if
CR4.PKE is clear, and then the corresponding bit is always clear in
mmu->permissions[byte].

Thus I think permission_fault() operates in just the same way even if
PFERR_PK_MASK is always set; CR4.PKE=0 is caught through the permissions
bitmask (as it's meant to be).

Instead of setting PFERR_PK_MASK, we can instead handle it in
permission_fault like:

	pkru = is_long_mode(vcpu) ? read_pkru() : 0;
	if (unlikely(pkru)) {
		...
		/* Set PK bit of pfec if pkru_bits is non-zero */
		pfec |= pkru_bits ? PFERR_PK_MASK : 0;
	}

I'll get to the topic of branches in another message.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux