Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Lance Yang <lance.yang@linux.dev>
To: songmuchun@bytedance.com
Cc: akpm@linux-foundation.org, rppt@kernel.org, maddy@linux.ibm.com,
	muchun.song@linux.dev, david@kernel.org, mpe@ellerman.id.au,
	ritesh.list@gmail.com, aneesh.kumar@linux.ibm.com,
	pavrampu@linux.ibm.com, lance.yang@linux.dev, qi.zheng@linux.dev,
	linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 5/7] powerpc/mm: fix uninitialized ZONE_DEVICE struct pages with PMDs
Date: Fri,  4 Dec 2026 17:29:21 +0800	[thread overview]
Message-ID: <20261204092921.65760-1-lance.yang@linux.dev> (raw)
In-Reply-To: <20261201115651.3400202-6-songmuchun@bytedance.com>


On Tue, Dec 01, 2026 at 07:56:49PM +0800, Muchun Song wrote:
>PowerPC radix vmemmap population can reuse an existing PMD mapping for
>a device DAX range marked HVO-enabled. The reused mapping is ordinary:
>its tail struct pages are not remapped to the shared tail page.
>
>Leaving the section marked HVO-enabled makes memmap_init_zone_device()
>treat the range as optimized and skip initializing real tail struct pages
>that remain in use. This first triggers a zone mismatch warning, then
>faults while initializing the pageblock flags:
>
>  WARNING: mm/mm_init.c:600 at __init_single_page+0xd0/0xf4
>  Call Trace:
>    memmap_init_zone_device+0x164/0x430
>    memremap_pages+0x43c/0x93c
>    devm_memremap_pages+0x3c/0xa4
>    dev_dax_probe+0x264/0x3d0
>    dax_bus_probe+0x140/0x1c8
>
>  BUG: Kernel NULL pointer dereference on read at 0x00001400
>    __set_pfnblock_flags_mask.constprop.0+0x34/0x160
>    memmap_init_zone_device+0x358/0x430
>
>Without these diagnostics, the uninitialized metadata remains latent until
>userspace accesses the device DAX range and triggers a later panic.
>
>Mark the section non-HVO when reusing a PMD mapping so its state matches
>the actual vmemmap layout and core ZONE_DEVICE code initializes all real
>struct pages.
>
>The Fixes target predates the section-based vmemmap optimization
>infrastructure, so this patch cannot be applied directly to some older
>kernels. Older kernels instead need to pass the vmemmap bounds to a
>range-aware vmemmap_can_optimize() and reject optimization on PowerPC if
>a PMD leaf overlaps the range. This reuses the existing mapping normally
>and makes core ZONE_DEVICE code initialize all real tail entries.
>
>Fixes: f2b79c0d7968 ("powerpc/book3s64/radix: add support for vmemmap optimization for radix")
>Cc: <stable@vger.kernel.org> # see patch description, needs a different fix for <= 7.3
>Signed-off-by: Muchun Song <songmuchun@bytedance.com>
>Reported-by: Pavithra <pavrampu@linux.ibm.com>
>Closes: https://lore.kernel.org/r/97f85592bb78a273be8519e6897e7f9b9bd31469.1793070429.git.ritesh.list@gmail.com
>Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
>Tested-by: Pavithra Prakash <pavrampu@linux.ibm.com>
>Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
>---

Good catch1

Reviewed-by: Lance Yang <lance.yang@linux.dev>

      reply	other threads:[~2026-12-04  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261201115651.3400202-1-songmuchun@bytedance.com>
2026-12-01 11:56 ` [PATCH 5/7] powerpc/mm: fix uninitialized ZONE_DEVICE struct pages with PMDs Muchun Song
2026-12-04  9:29   ` Lance Yang [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=20261204092921.65760-1-lance.yang@linux.dev \
    --to=lance.yang@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=muchun.song@linux.dev \
    --cc=pavrampu@linux.ibm.com \
    --cc=qi.zheng@linux.dev \
    --cc=ritesh.list@gmail.com \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=stable@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox