linux-yocto/fs/proc
Jinjiang Tu 2a1f366397 mm/smaps: fix race between smaps_hugetlb_range and migration
[ Upstream commit 45d19b4b6c2d422771c29b83462d84afcbb33f01 ]

smaps_hugetlb_range() handles the pte without holdling ptl, and may be
concurrenct with migration, leaing to BUG_ON in pfn_swap_entry_to_page().
The race is as follows.

smaps_hugetlb_range              migrate_pages
  huge_ptep_get
                                   remove_migration_ptes
				   folio_unlock
  pfn_swap_entry_folio
    BUG_ON

To fix it, hold ptl lock in smaps_hugetlb_range().

Link: https://lkml.kernel.org/r/20250724090958.455887-1-tujinjiang@huawei.com
Link: https://lkml.kernel.org/r/20250724090958.455887-2-tujinjiang@huawei.com
Fixes: 25ee01a2fc ("mm: hugetlb: proc: add hugetlb-related fields to /proc/PID/smaps")
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
Acked-by: David Hildenbrand <david@redhat.com>
Cc: Andrei Vagin <avagin@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Brahmajit Das <brahmajit.xyz@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: David Rientjes <rientjes@google.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Joern Engel <joern@logfs.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:30:17 +02:00
..
array.c fs/proc: do_task_stat: Fix ESP not readable during coredump 2025-02-17 10:05:04 +01:00
base.c fs/procfs: fix the comment above proc_pid_wchan() 2025-04-10 14:39:26 +02:00
bootconfig.c
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al 2025-08-15 12:13:53 +02:00
inode.c proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al 2025-08-15 12:13:53 +02:00
internal.h proc: use the same treatment to check proc_lseek as ones for proc_read_iter et.al 2025-08-15 12:13:53 +02:00
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile
meminfo.c
namespaces.c
nommu.c
page.c
proc_net.c
proc_sysctl.c fix proc_sys_compare() handling of in-lookup dentries 2025-07-17 18:37:04 +02:00
proc_tty.c
root.c
self.c
softirqs.c
stat.c
task_mmu.c mm/smaps: fix race between smaps_hugetlb_range and migration 2025-08-20 18:30:17 +02:00
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c fs/proc: fix softlockup in __read_vmcore (part 2) 2025-01-23 17:23:01 +01:00