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 0322E471240; Tue, 21 Jul 2026 18:32:53 +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=1784658774; cv=none; b=sMEcMLgRoMVbD6VfLSqAlzoCrrmDB+TVXu6SwtAVs4w/x2T6v9esx8IJQU/pIllY0l//RgUwuC2GaJDek5PMZCaH+7VyfVW3dTLETqbJyWNIKpexwE4P0lwT7C9b30VmTqGF0u4pUjaPONiMXTTSIdfMw7Hudw6zU297c9ai+r0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784658774; c=relaxed/simple; bh=Ay+HOaY+UfBxIk4iIZ7MoRb8G55Q+njfsYWy/9oKjoU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A2HVU1NcHmNeNmXuknXAcDhQsOWwirDSV3FjuQHa4QQ7E6FrnCTqNXzgwGB8d9Suj0CFCXYecLkoberwdsiPvCRIpHP/E7R/tCi1vnlqJhHj17ntbeerEU9Cd0hAdB4GTUs3lwbnwZ52gjM89XYT5o/uoYKqfWJuylT5NYljq28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=i3fteewA; 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="i3fteewA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 658AA1F000E9; Tue, 21 Jul 2026 18:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784658772; bh=WNIel22NAIyoAynNBtT/Asg35mqt595JfidHG5W+u8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=i3fteewAimmZ2UUBVuJ/QUJmRu6Jben1vv4zQlqRJoUA2wiQ3aWl5ZMbgPMnJR4za sX7VkOG2hSOU8HAigPC4nuqaIijm4DkVBzrsY3vOwta+ba/3eZFFTwynTWSjaaTHm+ 4nq5OfQvWru/HZpH3boY10Id3RYZHc/ABTIB3RIw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kiryl Shutsemau , Sashiko AI review , Lorenzo Stoakes , Dev Jain , David Hildenbrand , Michal Hocko , Mike Rapoport , Peter Xu , Suren Baghdasaryan , Vlastimil Babka , Balbir Singh , Andrew Morton Subject: [PATCH 6.18 1253/1611] fs/proc/task_mmu: use huge_page_size() in pagemap_scan_hugetlb_entry() Date: Tue, 21 Jul 2026 17:22:49 +0200 Message-ID: <20260721152543.628898614@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kiryl Shutsemau (Meta) commit 1b074e3270e1c061c829150c742eb83bad4dddd1 upstream. The partial-page check compares against HPAGE_SIZE (PMD_SIZE), which is wrong for gigantic hugetlb hstates (e.g. 1G). The walker hands the callback a huge_page_size()-sized range, never start + HPAGE_SIZE, so the comparison always declares it partial and aborts the WP. Compare against the actual hstate's page size. Link: https://lore.kernel.org/20260529172331.356655-3-kas@kernel.org Fixes: 52526ca7fdb9 ("fs/proc/task_mmu: implement IOCTL to get and optionally clear info about PTEs") Signed-off-by: Kiryl Shutsemau Reported-by: Sashiko AI review Reviewed-by: Lorenzo Stoakes Reviewed-by: Dev Jain Cc: David Hildenbrand Cc: Michal Hocko Cc: Mike Rapoport Cc: Peter Xu Cc: Suren Baghdasaryan Cc: Vlastimil Babka Cc: Balbir Singh Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/proc/task_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -2834,7 +2834,7 @@ static int pagemap_scan_hugetlb_entry(pt if (~categories & PAGE_IS_WRITTEN) goto out_unlock; - if (end != start + HPAGE_SIZE) { + if (end != start + huge_page_size(hstate_vma(vma))) { /* Partial HugeTLB page WP isn't possible. */ pagemap_scan_backout_range(p, start, end); p->arg.walk_end = start;