Skip to content

Commit 9774026

Browse files
kirylhansendc
authored andcommitted
x86/mm/iommu/sva: Do not allow to set FORCE_TAGGED_SVA bit from outside
arch_prctl(ARCH_FORCE_TAGGED_SVA) overrides the default and allows LAM and SVA to co-exist in the process. It is expected by called by the process when it knows what it is doing. arch_prctl() operates on the current process, but the same code is reachable from ptrace where it can be called on arbitrary task. Make it strict and only allow to set MM_CONTEXT_FORCE_TAGGED_SVA for the current process. Fixes: 23e5d9e ("x86/mm/iommu/sva: Make LAM and SVA mutually exclusive") Suggested-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> Link: https://lore.kernel.org/all/20230403111020.3136-3-kirill.shutemov%40linux.intel.com
1 parent fca1fdd commit 9774026

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

arch/x86/kernel/process_64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
883883
case ARCH_ENABLE_TAGGED_ADDR:
884884
return prctl_enable_tagged_addr(task->mm, arg2);
885885
case ARCH_FORCE_TAGGED_SVA:
886+
if (current != task)
887+
return -EINVAL;
886888
set_bit(MM_CONTEXT_FORCE_TAGGED_SVA, &task->mm->context.flags);
887889
return 0;
888890
case ARCH_GET_MAX_TAG_BITS:

0 commit comments

Comments
 (0)