mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li Zhe" <lizhe.67@bytedance.com>
To: <muchun.song@linux.dev>, <osalvador@suse.de>, <david@kernel.org>,
	 <akpm@linux-foundation.org>, <rppt@kernel.org>,
	<peterx@redhat.com>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	 "Li Zhe" <lizhe.67@bytedance.com>
Subject: [PATCH V2 0/3] mm/hugetlb: fix mremap bugs
Date: Mon, 19 Oct 2026 19:30:31 +0800	[thread overview]
Message-ID: <20261019113034.97690-1-lizhe.67@bytedance.com> (raw)

This series fixes a few hugetlb mremap bugs.

Patch 1 fixes the return type of move_hugetlb_page_tables(), so large
hugetlb moves cannot be truncated when reported back to the generic
mremap code.

Patch 2 disables hugetlb PMD sharing for UFFD missing mode, because
UFFDIO_POISON can install PTE markers that must not become shared PMD
page-table state.

Patch 3 fixes the recursive i_mmap_rwsem deadlock in the hugetlb mremap
path by avoiding the destination PMD sharing allocation path while the
mapping lock is already held for write.

David Hildenbrand (Arm) (1):
  mm/hugetlb: disable PMD sharing for UFFD missing mode

Li Zhe (2):
  mm/hugetlb: fix mremap move length truncation
  mm/hugetlb: fix mremap deadlock when PMD sharing is possible

 include/linux/hugetlb.h       | 18 +++++------
 include/linux/userfaultfd_k.h | 13 +++++---
 mm/hugetlb.c                  | 56 ++++++++++++++++++++++++++---------
 3 files changed, 60 insertions(+), 27 deletions(-)

---
v1: https://lore.kernel.org/all/20260930064308.58159-1-lizhe.67@bytedance.com/

ChangeLogs:

v1->v2:
- Add a fix for the newly discovered move_hugetlb_page_tables()
  return type issue.
- Disable hugetlb PMD sharing for UFFD missing mode.
- Rework the mremap deadlock fix to zap the source range and let the
  destination fault path populate or share the PMD lazily, as suggested
  by David.
    	
-- 
2.20.1

             reply	other threads:[~2026-10-19 11:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 11:30 Li Zhe [this message]
2026-10-19 11:30 ` [PATCH V2 1/3] mm/hugetlb: fix mremap move length truncation Li Zhe
2026-10-20  8:18   ` David Hildenbrand (Arm)
2026-10-21  2:38     ` Li Zhe
2026-10-19 11:30 ` [PATCH V2 2/3] mm/hugetlb: disable PMD sharing for UFFD missing mode Li Zhe
2026-10-20 10:11   ` Mike Rapoport
2026-10-20 10:33     ` David Hildenbrand (Arm)
2026-10-21  3:11       ` Li Zhe
2026-10-19 11:30 ` [PATCH V2 3/3] mm/hugetlb: fix mremap deadlock when PMD sharing is possible Li Zhe

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=20261019113034.97690-1-lizhe.67@bytedance.com \
    --to=lizhe.67@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=rppt@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®