From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796376573; b=02yIx7iasoBhGU8DY6YhbZ9exnINHNK8DwpHpndkkiyzU66zbgWpY+y+CFl9+UyBGsqo hmUFHWfotjQ6icYAPZkF9LitIKaPSpQjHnVmloQ7P7JTJ89v9s+wqmaquNlY+a0CTNWPU XnfUqhshR7KrXNWLIIs6SZBSFPwVaOcMzwXAjWgjgNBO2hkwQGfiM7RgawAhbBvfwhlLv WA4bnU911To5MjpvpPd2Uo67W8nEYMeFOtZXglsoYhVpfPAuGPIrJB3kexN2MYJ6ENLQX ov5Z+pnyomv2Khkc9laNhVKd3D1cJGg41bx/8K3ilQ9jKja2ZBGoDr7H+YWcp5MGxtg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796376573; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=r5z5P/CTRWXpOKCBDRnShdE/0+v5EBkdrNfWiiz3cLQ=; b=CIprhIpvl477XwgJ45aktx2wu2sOW222g0pexOyz9P2hjyMdSMvWkMeF0t9Ce/8raqgO uPyso5PIS75IHPZX6HqWVWpH5WW90J1d9KXLO9WwKQsQ2LnNy9zuYkpxE4LfN8+Qfibcf B9wElgZ8dIEvB6HGJl2GaCvrAX2rL7F5QVHCUkMUlBlr6EdqvHvutrJ4OYxXUWG8C/IX+ 4KmbkCqDv1lmBsbv2DIVkbrLNw9kyCbRnhYLS+/tc5gYGCkBT+kehR1jfW5nUG8ZbZ9rR GRxGj2kKyl2I3Ta/tyW1QqQGiLjkkuhRhrfGZxISr2C0F8npNXKcK+MpXV0xvr+RgVA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=YOSzoiYG; arc=none smtp.remote-ip=95.215.58.198 Received: from mta1.migadu.com (out-198.mta1.migadu.com [95.215.58.198]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C4412606A322 for ; Fri, 4 Dec 2026 09:29:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4412606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=YOSzoiYG X-Envelope-To: stable@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=SaWhl+jpjEgxc8RpnMdlxmPsLQeZPoxqXWXK/l1ZAsg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796376570; v=1; x=1796981370; b=YOSzoiYGYo5nG/UejqA8bqpfxK8oxpABAQ92TRhVayjFD+X0w1pEsAmE+TBjrmr85Wk+zl39 Ty35qXzFgS6qZhVauMPBrFEuFh9V9lfsroKumtVNHr/BmfjIWUJ6viyNFKQxfYHzN6Q60rvhSCp 6zFrndf8merbvGt6+NxPvReY= X-Envelope-To: stable@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 5be76bb6f357da8d; Fri, 04 Dec 2026 09:29:30 +0000 X-Mizu-Trace-ID: 5be76bb6f357da8d X-Migadu-Flow: FLOW_OUT From: Lance Yang 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 Message-ID: <20261204092921.65760-1-lance.yang@linux.dev> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20261201115651.3400202-6-songmuchun@bytedance.com> References: <20261201115651.3400202-6-songmuchun@bytedance.com> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: # see patch description, needs a different fix for <= 7.3 >Signed-off-by: Muchun Song >Reported-by: Pavithra >Closes: https://lore.kernel.org/r/97f85592bb78a273be8519e6897e7f9b9bd31469.1793070429.git.ritesh.list@gmail.com >Reviewed-by: Ritesh Harjani (IBM) >Tested-by: Pavithra Prakash >Acked-by: Mike Rapoport (Microsoft) >--- Good catch1 Reviewed-by: Lance Yang