From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A4983DCDA9 for ; Wed, 22 Jul 2026 04:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784694800; cv=none; b=Z6/6JMLjMUdpe/PNhY5/EU9yZxsb68r/+SHXdzTe5v9BiaP4xOGb/crheVCsajVyxPaGG4JTIRLeIYGRcYsbhLTElJ5SutnmN3tlKtko+QSC6RVsL4ynypffT/cd92nTr9GPAq6NwREDw3Izb5TwEcip40QYSc8tHayDNQjZN2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784694800; c=relaxed/simple; bh=qUwOyYyxJlbMFmKAIAJ1m806FYR7SWozC8Yg9pfLJo0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=VoWeidcZcwvmVmeDOCi5gg1gUGol/1t5N8tBwzHC6embwLOle509+0P6cIQAry0N20a+xYDdBHovBChP6416Qyp0S0SiWutfG+JZkkykCVX2D41LI5ROysC71MHNUNFpYhMZrSqV6dslRX8KfHZOqr6kkTpHnhcRwgQNk8if9gY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=J8StVHGQ; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="J8StVHGQ" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E9867152B; Tue, 21 Jul 2026 21:33:11 -0700 (PDT) Received: from [10.164.19.44] (unknown [10.164.19.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 00E363F86F; Tue, 21 Jul 2026 21:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784694796; bh=qUwOyYyxJlbMFmKAIAJ1m806FYR7SWozC8Yg9pfLJo0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=J8StVHGQbtg0VuqzhPoahZpWhk3VEW2Mz09ov6/YpK0U9xNEaJP1SMI4FmTGve2Bn QM1KpqpA8kfKdVYel3jLY3MRJe/jEQ/78fiS12mJC5DaucwegF2PT1QHl7fPSxpQAf vDWwsyVfBfFS2O1trdUQ6CxFX2XwDPaJhRfGK+z0= Message-ID: <4bb234f7-5f3a-452d-92dd-a1e62b6f39aa@arm.com> Date: Wed, 22 Jul 2026 10:03:04 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 0/6] Fix incorrect access of hugetlb pte entries To: Andrew Morton , Will Deacon Cc: muchun.song@linux.dev, osalvador@suse.de, ljs@kernel.org, david@kernel.org, liam@infradead.org, catalin.marinas@arm.com, kernel-team@android.com, riel@surriel.com, vbabka@kernel.org, harry@kernel.org, jannh@google.com, lance.yang@linux.dev, kas@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, apopple@nvidia.com, rcampbell@nvidia.com, ziy@nvidia.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, ak@linux.intel.com, nao.horiguchi@gmail.com, mel@csn.ul.ie, j-nomura@ce.jp.nec.com, pfalcato@suse.de, tglx@kernel.org, dave.hansen@intel.com, jpoimboe@kernel.org, linux-arm-kernel@lists.infradead.org, ryan.roberts@arm.com, anshuman.khandual@arm.com References: <20260703114202.365553-1-dev.jain@arm.com> <178464737122.1305746.12295190523058911270.b4-ty@kernel.org> <20260721133636.df1a012df895054d3fd34a2e@linux-foundation.org> Content-Language: en-US From: Dev Jain In-Reply-To: <20260721133636.df1a012df895054d3fd34a2e@linux-foundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 22/07/26 2:06 am, Andrew Morton wrote: > On Tue, 21 Jul 2026 18:18:38 +0100 Will Deacon wrote: > >> On Fri, 03 Jul 2026 11:41:53 +0000, Dev Jain wrote: >>> There are various places which use ptep_get() to get the pte entry >>> corresponding to a hugetlb folio. Some arches (like s390) have special >>> handling to compute the pteval, so they provide huge_ptep_get(). Use this >>> helper consistently. >>> >>> Additionally, some code paths may provide huge_ptep_get with an unaligned >>> address. This is a problem on arm64 (I checked other arches and it looks >>> fine for them), which is fixed in patch 1. The fix is made to be >>> to huge_ptep_get() - that is wider churn and we can do that later. >>> >>> [...] >> >> Applied first patch to arm64 (for-next/fixes), thanks! >> >> [1/6] arm64: make huge_ptep_get handled unaligned addresses >> https://git.kernel.org/arm64/c/9175a8c7cfe88 >> >> I'm hoping Andrew can drop this from the mm tree to avoid a duplicate, >> but I didn't hear back yet and I'd like to land the fix. > > I can redo Dev's series to omit [1/6]. The patches apply that way, but > there might be build-time or runtime issues running the other patches > without [1/6] present, haven't looked. > > Also, review indicates that the changelog requires updating > (https://lore.kernel.org/all/2b9d60a2-8698-46b0-80ae-b8747a66a85b@kernel.org/) > and I believe that Dev plans to do that. Oh I was banking on you to do that : ) @Will if you could edit the commit message with the following userspace visible effect: "On systems where CONT_PTES != CONT_PMDS (meaning page size is 16K), we could collect excess a/d bit state, meaning extra work for the kernel. Even worse, we may iterate beyond the PTE table and dereference a garbage ptep pointer to access physical memory we don't own. Since the ptep pointer is a linear map address, we may run off the end of the linear map, dereference a VA not mapped into the kernel pgtables and cause kernel panic." > > IOW, it would be better to carry this in mm.git with your ack. > > Do you plan to upstream this in 7.2-rcX? If so then I can hang onto > this patch until it appears in mainline. Or something.