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 CA384390610; Fri, 4 Sep 2026 06:05:08 +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=1788501911; cv=none; b=MTXViDBhysLZ3F8AucRp8Wv08UTmR4eFjGOrfUgvVfPR8SzylyHtAc5kv8Ing6INvTImr5EkPRPJkoBf3ZAnB/dVCWhP2gxuM+5PRh4oJ74Q6r6Idh1oNDT3jtEEgJfTJ6QzrAOOFzzF55zBUJUVlIY4/EOA0zfHEzY7ouGZ+kE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788501911; c=relaxed/simple; bh=Am5OTNz0Yt4ZgNnXL2HSXpSXD7KQlTqEC5fveMi646g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JNhS1cG/PiMjK4skyM7Ll9a0YsdToKy0lRFbmaxV5Y1NotRlX7v0VDFBT61pCWRBycrgj7vQfnAW9lcemt1a/DZvcFSG41bsrNx4bJNLxQSxjU4SVxhH7S/a1r7TEwGg8g5sfV7MoYkqagfFAcWz31nU7U8Xg5hMNpWTCqOLOWc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IQJ1AM8m; 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="IQJ1AM8m" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F68D1F00A3D; Fri, 4 Sep 2026 06:05:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1788501908; bh=Yf7C8TM0byMqV8fL30+lz6oECS2RZKFDRWEqwlPC38E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IQJ1AM8mRkOMMtSsEtlBn2BsYos42yr7QbSUToXsUsCvyWQ+x94T9phVznRlCJP6t /g15cMBXTtKXHa0tXqSJByR7+JjwnrI0sS9kqKS7G/kVICTwY4tPljVAKbuxnVf4fj WvUPW289OEhE5Zcd+pm9lIFAb0kty9c9hhUlPcWE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dev Jain , Muchun Song , "David Hildenbrand (Arm)" , Alistair Popple , Andi Kleen , Anshuman Khandual , Byungchul Park , Catalin Marinas , Dave Hansen , Gregory Price , Harry Yoo , "Huang, Ying" , Jann Horn , Josh Poimboeuf , Joshua Hahn , =?UTF-8?q?Junichi=20 Nick =20Nomura?= , Kiryl Shutsemau , Lance Yang , "Liam R. Howlett" , Lorenzo Stoakes , Matthew Brost , Mel Gorman , Naoya Horiguchi , Oscar Salvador , Pedro Falcato , Rakie Kim , Ralph Campbell , Rik van Riel , Ryan Roberts , Vlastimil Babka , Will Deacon , Zi Yan , Andrew Morton Subject: [PATCH 6.12 022/403] mm/migrate: use huge_ptep_get() in remove_migration_pte() Date: Fri, 4 Sep 2026 06:57:05 +0200 Message-ID: <20260904045735.316373280@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260904045734.806166532@linuxfoundation.org> References: <20260904045734.806166532@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dev Jain commit ac1ec50d71b953524100ddc09057ee61a3dfaff3 upstream. remove_migration_pte() converts migration entries back to present PTEs after folio migration completes. For hugetlb folios, page_vma_mapped_walk() returns the pte pointer to the hugetlb folio in pvmw.pte, but the code reads it with ptep_get(). On arches which provide their own huge_ptep_get() to dereference a huge pte pointer, accessing via ptep_get() would cause pte_pfn(), pte_present() etc to misbehave. It is not clear whether this has a trivially visible effect to userspace. Use huge_ptep_get() to dereference a huge pte pointer. Link: https://lore.kernel.org/20260703114202.365553-5-dev.jain@arm.com Fixes: 290408d4a250 ("hugetlb: hugepage migration core") Signed-off-by: Dev Jain Acked-by: Muchun Song Acked-by: David Hildenbrand (Arm) Cc: Alistair Popple Cc: Andi Kleen Cc: Anshuman Khandual Cc: Byungchul Park Cc: Catalin Marinas Cc: Dave Hansen Cc: Gregory Price Cc: Harry Yoo Cc: "Huang, Ying" Cc: Jann Horn Cc: Josh Poimboeuf Cc: Joshua Hahn Cc: Jun'ichi "Nick" Nomura Cc: Kiryl Shutsemau Cc: Lance Yang Cc: Liam R. Howlett Cc: Lorenzo Stoakes Cc: Matthew Brost Cc: Mel Gorman Cc: Naoya Horiguchi Cc: Oscar Salvador Cc: Pedro Falcato Cc: Rakie Kim Cc: Ralph Campbell Cc: Rik van Riel Cc: Ryan Roberts Cc: Vlastimil Babka Cc: Will Deacon Cc: Zi Yan Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/migrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -313,7 +313,11 @@ static bool remove_migration_pte(struct continue; } #endif - old_pte = ptep_get(pvmw.pte); + if (folio_test_hugetlb(folio)) + old_pte = huge_ptep_get(vma->vm_mm, pvmw.address, + pvmw.pte); + else + old_pte = ptep_get(pvmw.pte); if (rmap_walk_arg->map_unused_to_zeropage && try_to_map_unused_to_zeropage(&pvmw, folio, old_pte, idx)) continue;