Commit 45d19b4
mm/smaps: fix race between smaps_hugetlb_range and migration
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/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 25ee01a ("mm: hugetlb: proc: add hugetlb-related fields to /proc/PID/smaps")
Signed-off-by: Jinjiang Tu <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Cc: Andrei Vagin <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Brahmajit Das <[email protected]>
Cc: Catalin Marinas <[email protected]>
Cc: Christophe Leroy <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Dev Jain <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Joern Engel <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Thiago Jung Bauermann <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent 366a453 commit 45d19b4
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1148 | 1148 | | |
1149 | 1149 | | |
1150 | 1150 | | |
1151 | | - | |
1152 | 1151 | | |
1153 | 1152 | | |
| 1153 | + | |
| 1154 | + | |
1154 | 1155 | | |
| 1156 | + | |
| 1157 | + | |
1155 | 1158 | | |
1156 | 1159 | | |
1157 | 1160 | | |
| |||
1170 | 1173 | | |
1171 | 1174 | | |
1172 | 1175 | | |
| 1176 | + | |
1173 | 1177 | | |
1174 | 1178 | | |
1175 | 1179 | | |
| |||
0 commit comments