lkml.org 
[lkml]   [2023]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCHv16 11/17] x86/mm/iommu/sva: Make LAM and SVA mutually exclusive
On Mon, 3 Apr 2023 at 11:44, Kirill A. Shutemov <kirill@shutemov.name> wrote:
>
> 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.

No, I don't have a particular race in mind. Was thinking solely about
consistency and if these things should be set for other processes
(relaxing the check is always possible in future, but adding new
restrictions is generally not possible).

> > 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().

It seems that currently it's possible to both enable LAM and set SVA bit.
Then arch_pgtable_dma_compat() will return true, but LAM is enabled.

\
 
 \ /
  Last update: 2023-04-03 11:57    [W:0.067 / U:0.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site