From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org,jaewook376@gmail.com,akpm@linux-foundation.org
Subject: [to-be-updated] mm-hugetlb-preserve-mremap-address-delta-when-skipping-page-tables.patch removed from -mm tree
Date: Mon, 14 Sep 2026 20:04:29 -0700 [thread overview]
Message-ID: <20260915030429.804C91F000FF@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm/hugetlb: preserve mremap address delta when skipping page tables
has been removed from the -mm tree. Its filename was
mm-hugetlb-preserve-mremap-address-delta-when-skipping-page-tables.patch
This patch was dropped because an updated version will be issued
------------------------------------------------------
From: Jaewook You <jaewook376@gmail.com>
Subject: mm/hugetlb: preserve mremap address delta when skipping page tables
Date: Sat, 12 Sep 2026 03:24:08 +0900
In move_hugetlb_page_tables(), optimize mremap() by advancing to the end
of the page table when the source page table does not exist, either
initially or after unsharing a PMD table.
However, the code advances both the source and destination addresses to
the end of 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/20260911182408.75821-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>
Assisted-by: LLM
Cc: David Hildenbrand <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>
---
mm/hugetlb.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
--- a/mm/hugetlb.c~mm-hugetlb-preserve-mremap-address-delta-when-skipping-page-tables
+++ a/mm/hugetlb.c
@@ -5226,18 +5226,21 @@ int move_hugetlb_page_tables(struct vm_a
hugetlb_vma_lock_write(vma);
i_mmap_lock_write(mapping);
for (; old_addr < old_end; old_addr += sz, new_addr += sz) {
+ const unsigned long remaining_size =
+ (old_addr | last_addr_mask) - old_addr;
+
src_pte = hugetlb_walk(vma, old_addr, sz);
if (!src_pte) {
- old_addr |= last_addr_mask;
- new_addr |= last_addr_mask;
+ old_addr += remaining_size;
+ new_addr += remaining_size;
continue;
}
if (huge_pte_none(huge_ptep_get(mm, old_addr, src_pte)))
continue;
if (huge_pmd_unshare(&tlb, vma, old_addr, src_pte)) {
- old_addr |= last_addr_mask;
- new_addr |= last_addr_mask;
+ old_addr += remaining_size;
+ new_addr += remaining_size;
continue;
}
_
Patches currently in -mm which might be from jaewook376@gmail.com are
reply other threads:[~2026-09-15 3:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260915030429.804C91F000FF@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=jaewook376@gmail.com \
--cc=mm-commits@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.