Hello Julien,

On 07/04/2016 06:15 PM, Julien Grall wrote:
> 
> 
> On 04/07/16 12:45, Sergej Proskurin wrote:
>> +static void p2m_teardown_hostp2m(struct domain *d)
>> +{
>> +    struct p2m_domain *p2m = p2m_get_hostp2m(d);
>> +    struct page_info *pg = NULL;
>> +    mfn_t mfn;
>> +    unsigned int i;
>> +
>> +    spin_lock(&p2m->lock);
>>
>> -    if ( p2m->root )
>> -        free_domheap_pages(p2m->root, P2M_ROOT_ORDER);
>> +    while ( (pg = page_list_remove_head(&p2m->pages)) )
>> +        if ( pg != p2m->root )
>> +        {
>> +            mfn = _mfn(page_to_mfn(pg));
>> +            clear_domain_page(mfn);
> 
> Can you explain why you are cleaning the page here? It was not part of
> p2m_teardown before this series.
> 

With the x86-based altp2m implementation, we experienced the problem
that altp2m-teardowns did not clean the pages. As a result, later
re-initialization reused the pages, which subsequently led to faults or
crashes due to reused mappings. We additionally clean the altp2m pages
and for the sake of completeness we clean the hostp2m tables as well.

>> +            free_domheap_page(pg);
>> +        }
>>
>> +    for ( i = 0; i < P2M_ROOT_PAGES; i++ )
>> +    {
>> +        mfn = _mfn(page_to_mfn(p2m->root) + i);
>> +        clear_domain_page(mfn);
>> +    }
>> +    free_domheap_pages(p2m->root, P2M_ROOT_ORDER);
>>       p2m->root = NULL;
>>
>>       p2m_free_vmid(d);
>> @@ -1422,7 +1506,7 @@ void p2m_teardown(struct domain *d)
>>       spin_unlock(&p2m->lock);
>>   }
> 
> Regards,
> 

Thank you very much.

Best regards,
Sergej

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to