diff options
| author | Jaewook You <jaewook376@gmail.com> | 2026-09-14 22:23:52 +0900 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-09-18 08:20:14 -0700 |
| commit | 9bdad082d44bdcf93716973dcba6be77e8a06e7b (patch) | |
| tree | 64999e04ae13aa4fa7887f0f7302b518d681a7e9 /tools/perf/tests/shell/test_stackcollapse_python.sh | |
| parent | b3723b596b548c837a766aae3553c14a7b15af2b (diff) | |
| download | linux-next-9bdad082d44bdcf93716973dcba6be77e8a06e7b.tar.gz linux-next-9bdad082d44bdcf93716973dcba6be77e8a06e7b.zip | |
mm/hugetlb: preserve mremap address delta when skipping page tables
move_hugetlb_page_tables() optimizes mremap() by advancing to the last
entry in the page table when the source page table does not exist, either
initially or after unsharing a PMD table. The common loop increment then
steps to the first entry in the next page table.
However, the code advances both the source and destination addresses to
the last entries in their respective page tables, which is wrong. The
destination address must be advanced only by the same amount as the source
address.
If the source and destination offsets within their page tables differ, the
destination address can be advanced too far, causing follow-up issues.
Fix this by advancing the destination address by the source advance
distance.
With a reproducer, we were able to trigger a kernel panic on x86-64. With
this fix in place, we can no longer reproduce the issue.
Link: https://lore.kernel.org/20260914132352.472-1-jaewook376@gmail.com
Fixes: e95a9851787b ("hugetlb: skip to end of PT page mapping when pte not present")
Fixes: 4ddb4d91b82f ("hugetlb: do not update address in huge_pmd_unshare")
Signed-off-by: Jaewook You <jaewook376@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: <stable@vger.kernel.org>
Assisted-by: LLM
Diffstat (limited to 'tools/perf/tests/shell/test_stackcollapse_python.sh')
0 files changed, 0 insertions, 0 deletions
