]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
um: Fix potential race condition in TLB sync
authorTiwei Bie <tiwei.btw@antgroup.com>
Mon, 2 Mar 2026 23:52:23 +0000 (07:52 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Sat, 21 Mar 2026 09:42:24 +0000 (10:42 +0100)
During the TLB sync, we need to traverse and modify the page table,
so we should hold the page table lock. Since full SMP support for
threads within the same process is still missing, let's disable the
split page table lock for simplicity.

Fixes: 1e4ee5135d81 ("um: Add initial SMP support")
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20260302235224.1915380-2-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/kernel/tlb.c
mm/Kconfig

index 39608cccf2c6900b0e9a3a08eb2f87a364d8913b..5386ab2d0da50561e7c42712d1783c838e27265f 100644 (file)
@@ -165,6 +165,7 @@ int um_tlb_sync(struct mm_struct *mm)
        unsigned long addr, next;
        int ret = 0;
 
+       guard(spinlock_irqsave)(&mm->page_table_lock);
        guard(spinlock_irqsave)(&mm->context.sync_tlb_lock);
 
        if (mm->context.sync_tlb_range_to == 0)
index ebd8ea353687e034a709835af3d79a0682fe453f..befa8909ae29df6f147333d8a05f08c642f0297d 100644 (file)
@@ -572,6 +572,7 @@ config SPLIT_PTE_PTLOCKS
        depends on !ARM || CPU_CACHE_VIPT
        depends on !PARISC || PA20
        depends on !SPARC32
+       depends on !UML
 
 config ARCH_ENABLE_SPLIT_PMD_PTLOCK
        bool