From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69B3F47604A; Fri, 7 Aug 2026 15:41:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786117274; cv=none; b=BNwTXDBj8l9sNVZ5+zjqC7bkUFpltwiGzaBEKmLxh8UVKQFzGdpibQ4PKTCq9JSrFKQ5A5HGpS7lQiJ7TQcFtxqWMW6cWk+kotzT+EjAoAhunLo2Nlbh/3kreAm3RNId5p3hkjjoyEK5f8+/sAHm90dFD2NKOe5VN79ZTlms9Lg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786117274; c=relaxed/simple; bh=SkG4Zt1RiX+rCevRgs2StLb0jJuQ7wMLbe4uQFSBt5U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tyBgFfx6mP1JyYKgmxUKAZQZ/FvQjHL6gBQnN16X0YjdPle1xNYgtyiwO2PtNaMbYyk7QYJAzv6xGVPu3iFzpLI9nDQpr7PMiq642Rp9ztw8vc0HCq/AnFZbBRCabMBR2SDf79MwexQlJNHfHJ72DcC68ukVvUVThQzQh34OpZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TrwGSZ/L; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="TrwGSZ/L" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDEE41F000E9; Fri, 7 Aug 2026 15:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786117273; bh=8wSSSWAq8DSzhzhnyFzmI6IhhkGMC0nXXhqyOhnVvqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TrwGSZ/LFF/t1Aup+haAYSsptRGJzXjDasd5Uj6gppEoXs4SbXi/TFJtOuOqdKIyX vVl+HpFNbfQ9LxGCAA+LjN+obgisThMaaVMD+Mub9pJrXXnCHccYACoOaV89vohGgg KeTVh3siZ6/xAPx038p5rPFyTpgKsLTXjwex5CkI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aboorva Devarajan , Sourabh Jain , "David Hildenbrand (Arm)" , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" , Luiz Capitulino , "Liam R. Howlett" , Michal Hocko , Mike Rapoport , "Ritesh Harjani (IBM)" , Suren Baghdasaryan , Vlastimil Babka , Andrew Morton Subject: [PATCH 7.1 216/438] mm/util: dont read __page_2 for order-1 folios in snapshot_page() Date: Fri, 7 Aug 2026 16:36:52 +0200 Message-ID: <20260807143432.615094687@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260807143428.008222056@linuxfoundation.org> References: <20260807143428.008222056@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aboorva Devarajan commit 7441d6348c70738e9ed307510db171c7a9b3f4bf upstream. snapshot_page() currently reads __page_2 after checking nr_pages > 1, but it should only do so when nr_pages > 2. If an order-1 folio is allocated at the end of a vmemmap section, __page_2 will not exist and reading it will cause a fault. During DLPAR memory remove on a 22 TB ppc64le LPAR, snapshot_page() oopsed on the page isolation path while reading an order-1 folio's __page_2 from an adjacent absent section (unmapped vmemmap). Fix this to avoid reading memmap that doesn't exist (e.g., a vmemmap hole). Link: https://lore.kernel.org/20260708201954.686111-1-aboorvad@linux.ibm.com Fixes: 31a31da8a618 ("mm: move _pincount in folio to page[2] on 32bit") Signed-off-by: Aboorva Devarajan Reported-by: Sourabh Jain Acked-by: David Hildenbrand (Arm) Reviewed-by: Lorenzo Stoakes Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Luiz Capitulino Cc: Liam R. Howlett Cc: Michal Hocko Cc: Mike Rapoport Cc: "Ritesh Harjani (IBM)" Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: # v6.15+ Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/util.c +++ b/mm/util.c @@ -1352,7 +1352,7 @@ again: if (ps->idx < MAX_FOLIO_NR_PAGES) { memcpy(&ps->folio_snapshot, foliop, 2 * sizeof(struct page)); nr_pages = folio_nr_pages(&ps->folio_snapshot); - if (nr_pages > 1) + if (nr_pages > 2) memcpy(&ps->folio_snapshot.__page_2, &foliop->__page_2, sizeof(struct page)); set_ps_flags(ps, foliop, page);