Re: [PATCHv16 11/17] x86/mm/iommu/sva: Make LAM and SVA mutually exclusive

From: Kirill A. Shutemov
Date: Mon Apr 03 2023 - 05:45:36 EST


On Mon, Apr 03, 2023 at 08:18:57AM +0200, Dmitry Vyukov wrote:
> Hi Kirill,
>
> ARCH_ENABLE_TAGGED_ADDR checks that task->mm == current->mm,
> shouldn't ARCH_FORCE_TAGGED_SVA check that as well?

Do you a particular race in mind? I cannot think of anything right away.

I guess we can add the check for consistency. But if there's a bug it is a
different story.

> Also it looks like currently to enable both LAM and SVA.
> LAM enabling checks for SVA, but SVA doesn't and both are not mutually
> exclusive.

For LAM we check SVM with mm_valid_pasid() && !test_bit() in
prctl_enable_tagged_addr().

For SVM we check for LAM with !mm_lam_cr3_mask() || test_bit() in
arch_pgtable_dma_compat() which called from iommu_sva_alloc_pasid().

Hm?


--
Kiryl Shutsemau / Kirill A. Shutemov