Re: [PATCHv10 10/15] x86/mm, iommu/sva: Make LAM and SVM mutually exclusive

From: Ashok Raj
Date: Tue Oct 18 2022 - 16:08:24 EST


On Tue, Oct 18, 2022 at 02:33:53PM +0300, Kirill A. Shutemov wrote:
> IOMMU and SVM-capable devices know nothing about LAM and only expect
> canonical addresses. Attempt to pass down tagged pointer will lead to
> address translation failure.
>
> By default do not allow to enable both LAM and use SVM in the same
> process.
>
> The new ARCH_FORCE_TAGGED_SVM arch_prctl() overrides the limitation.
> By using the arch_prctl() userspace takes responsibility to never pass
> tagged address to the device.

Reviewed-by: Ashok Raj <ashok.raj@xxxxxxxxx>

>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> ---
> arch/x86/include/asm/mmu.h | 6 ++++--
> arch/x86/include/asm/mmu_context.h | 2 ++
> arch/x86/include/uapi/asm/prctl.h | 1 +
> arch/x86/kernel/process_64.c | 13 +++++++++++++
> drivers/iommu/iommu-sva-lib.c | 12 ++++++++++++
> include/linux/mmu_context.h | 4 ++++
> 6 files changed, 36 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/mmu.h b/arch/x86/include/asm/mmu.h
> index 2fdb390040b5..cce9b32b0d6d 100644
> --- a/arch/x86/include/asm/mmu.h
> +++ b/arch/x86/include/asm/mmu.h
> @@ -9,9 +9,11 @@
> #include <linux/bits.h>
>
> /* Uprobes on this MM assume 32-bit code */
> -#define MM_CONTEXT_UPROBE_IA32 BIT(0)
> +#define MM_CONTEXT_UPROBE_IA32 BIT(0)
> /* vsyscall page is accessible on this MM */
> -#define MM_CONTEXT_HAS_VSYSCALL BIT(1)
> +#define MM_CONTEXT_HAS_VSYSCALL BIT(1)

Nit: Looks like the two above format changes got in here :-)

Cheers,
Ashok