Re: [kvm-unit-tests PATCH v2] s390x: IEP tests

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

 



On 11.06.2018 12:42, David Hildenbrand wrote:
> 
>>> +static void test_iep(void)
>>> +{
>>> +	uint16_t *code;
>>> +	uint8_t *iepbuf = NULL;
>>> +	void (*fn)(void);
>>> +
>>> +	/* Enable IEP */
>>> +	ctl_set_bit(0, 20);
>>> +
>>> +	/* Get and protect a page with the IEP bit */
>>> +	iepbuf = alloc_page();
>>> +	protect_page(iepbuf, PAGE_ENTRY_IEP);
>>> +
>>> +	/* Code branches into r14 which contains the return address. */
>>> +	code = (uint16_t *)iepbuf;
>>> +	*code = 0x07fe;
>>> +	fn = (void *)code;
>>
>> Not sure if I've got Christian's comment wrt to ipte right, but if I did
>> (Christian, please correct me if I'm wrong), I think it's better to move
>> the "protect_page(iepbuf, PAGE_ENTRY_IEP)" here, so that the ipte is
>> called after you've modified the contents of the page.
> 
> Why? When we replace the entry (protect), we do an ipte. Next access
> will reload the right page table entry including protection. What am I
> missing?

Never mind, as explained by Christian, it's not necessary here. I'm just
too paranoid after running into cache-flush issues on ppc in the past ;-)

 Thomas



[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