On 22.12.2020 16:43, Julien Grall wrote: > From: Julien Grall <[email protected]> > > The pgtables.lock is protecting access to the page list pgtables.list. > However, iommu_free_pgtables() will not held it. I guess it was assumed > that page-tables cannot be allocated while the domain is dying. > > Unfortunately, there is no guarantee that iommu_map() will not be > called while a domain is dying (it looks like to be possible from > XEN_DOMCTL_memory_mapping).
I'd rather disallow any new allocations for a dying domain, not the least because ... > So it would be possible to be concurrently > allocate memory and free the page-tables. > > Therefore, we need to held the lock when freeing the page tables. ... we should try to avoid holding locks across allocation / freeing functions wherever possible. As to where to place a respective check - I wonder if we wouldn't be better off disallowing a majority of domctl-s (and perhaps other operations) on dying domains. Thoughts? Jan
