Commit f39edcf
mm: pgtable: fix incorrect reclaim of non-empty PTE pages
In zap_pte_range(), if the pte lock was released midway, the pte entries
may be refilled with physical pages by another thread, which may cause a
non-empty PTE page to be reclaimed and eventually cause the system to
crash.
To fix it, fall back to the slow path in this case to recheck if all pte
entries are still none.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 6375e95 ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)")
Signed-off-by: Qi Zheng <[email protected]>
Reported-by: Christian Brauner <[email protected]>
Closes: https://lore.kernel.org/all/20250207-anbot-bankfilialen-acce9d79a2c7@brauner/
Reported-by: Qu Wenruo <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Tested-by: Zi Yan <[email protected]>
Cc: <[email protected]>
Cc: "Darrick J. Wong" <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Jann Horn <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>1 parent b016d08 commit f39edcf
1 file changed
+14
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1719 | 1719 | | |
1720 | 1720 | | |
1721 | 1721 | | |
1722 | | - | |
| 1722 | + | |
1723 | 1723 | | |
1724 | 1724 | | |
1725 | 1725 | | |
| |||
1734 | 1734 | | |
1735 | 1735 | | |
1736 | 1736 | | |
1737 | | - | |
| 1737 | + | |
| 1738 | + | |
1738 | 1739 | | |
| 1740 | + | |
1739 | 1741 | | |
1740 | 1742 | | |
1741 | 1743 | | |
1742 | 1744 | | |
1743 | 1745 | | |
1744 | 1746 | | |
1745 | 1747 | | |
| 1748 | + | |
1746 | 1749 | | |
1747 | 1750 | | |
1748 | 1751 | | |
1749 | 1752 | | |
1750 | | - | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
1751 | 1762 | | |
1752 | 1763 | | |
1753 | 1764 | | |
| |||
0 commit comments