linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Chris Down <chris@chrisdown.name>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <willy@infradead.org>,
	kernel-team@fb.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 0/2] mm/huge_memory: fix move_pages_huge_pmd() for huge zero pages
Date: Wed, 18 Feb 2026 09:01:35 +0100	[thread overview]
Message-ID: <f791fed9-5d90-4d17-bffd-985dc83ec0cd@kernel.org> (raw)
In-Reply-To: <aZU1kTOLcrr-Z371@chrisdown.name>

On 2/18/26 04:44, Chris Down wrote:
> Two fixes for the huge zero page path in move_pages_huge_pmd()
> (UFFDIO_MOVE).
> 
> Patch 1 fixes a use of NULL folio introduced by the folio_mk_pmd()
> conversion in commit e3981db444a0 ("mm: add folio_mk_pmd()").
> mk_huge_pmd(src_page, ...) with folio_mk_pmd(src_folio, ...) in the huge
> zero page branch where src_folio is explicitly NULL. With
> SPARSEMEM_VMEMMAP this silently produces a PMD with a bogus PFN, on
> other memory models it is a NULL deref.
> 
> Patch 2 adds the missing pmd_mkspecial() call that was omitted when
> commit d82d09e48219 ("mm/huge_memory: mark PMD mappings of the huge zero
> folio special") marked huge zero folio PMD mappings as special. Without
> it, vm_normal_page_pmd() on CONFIG_ARCH_HAS_PTE_SPECIAL architectures
> does not recognise the moved huge zero page as special, incorrectly
> treating it as a normal page and corrupting its refcount.

Thanks for the report and fixes. This sounds like something selftests 
should have detected.

Can we teach  tools/testing/selftests/mm/uffd-unit-tests.c to trigger 
that behavior on the huge zero folio?

We have uffd_move_pmd_test(), but it seems to focus on moving non-zero 
folios I suppose.

-- 
Cheers,

David


      reply	other threads:[~2026-02-18  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18  3:44 Chris Down
2026-02-18  8:01 ` David Hildenbrand (Arm) [this message]

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=f791fed9-5d90-4d17-bffd-985dc83ec0cd@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chrisdown.name \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.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