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 74B442737F8 for ; Thu, 2 Jul 2026 05:14:12 +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=1782969254; cv=none; b=O7HfKcrYsakkuK2hAlkMna4QgeV6gUrW3i0kdMnYjUifQ/gNn8HgdAQpOm32OPuP0Hh6STP90/tPgEpnWTb54iS3MMFomcXrCiLKvwPvVQz5pRjcDbOVccJLJZQz9EDTYEjwIlLTUwgT6rtZL1XPunx/QgbyglZpHdO1aWJNwV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782969254; c=relaxed/simple; bh=GBEwdvQfsBB33jxX2WsSLwobJOlQGrrqxOQ+45Al7L8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=HkbPfGedLW7XWMRDJJUEKZMBAG5tuo2mQ+u8hSrD275X3agJetDM48iNyQ4XcoX0z/+QcGL82IkqNcIND7A6TyR48OKsLjcYtfmdUOlqchVUskEnLadUX/sFFJquD2/furIRy+7evPL7VLNwOYimlfbeiUmISXM+oIS72hTInZs= 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=HO6URRUp; 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="HO6URRUp" 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 362CB3580; Wed, 1 Jul 2026 22:14:07 -0700 (PDT) Received: from cesw-amp-gbt-1s-m12830-01.blr.arm.com (cesw-amp-gbt-1s-m12830-01.blr.arm.com [10.164.195.31]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 411CE3F85F; Wed, 1 Jul 2026 22:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782969251; bh=GBEwdvQfsBB33jxX2WsSLwobJOlQGrrqxOQ+45Al7L8=; h=From:To:Cc:Subject:Date:From; b=HO6URRUp9xtDNWrDMW9g4YfZa9P5WhTXzTbwfaQ/Dwx2XrYhcs+FbzD/asfeNhtvd A3lOPCKjmIEShSKH0S6ZH2dTMGRZOkYtCXkHovSetRqQQH17yxW+Vhhr5zkGs4sTyb fLVg+jdj6wo431KhBToC0j2IPtBfLYVVmx1qaVlE= From: Dev Jain To: muchun.song@linux.dev, osalvador@suse.de, akpm@linux-foundation.org, ljs@kernel.org, david@kernel.org, liam@infradead.org Cc: Dev Jain , 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, rcampbell@nvidia.com, apopple@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, j-nomura@ce.jp.nec.com, nao.horiguchi@gmail.com, ak@linux.intel.com, mel@csn.ul.ie, pfalcato@suse.de, jpoimboe@kernel.org, dave.hansen@intel.com, tglx@kernel.org, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, ryan.roberts@arm.com, anshuman.khandual@arm.com Subject: [PATCH v2 0/6] Fix incorrect access of hugetlb pte entries Date: Thu, 2 Jul 2026 05:13:34 +0000 Message-ID: <20260702051341.126509-1-dev.jain@arm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 backport-friendly: the cleaner fix would be to perhaps pass the hstate to huge_ptep_get() - that is wider churn and we can do that later. --- v1->v2: - Add patch 1 - Mention s390 in cover letter Dev Jain (6): arm64: make huge_ptep_get handled unaligned addresses mm/rmap: use huge_ptep_get() in try_to_unmap_one() mm/rmap: use huge_ptep_get() in try_to_migrate_one() mm/migrate: use huge_ptep_get() in remove_migration_pte() mm/page_vma_mapped: use huge_ptep_get() for hugetlb mm/mprotect: use huge_ptep_get() for hugetlb arch/arm64/mm/hugetlbpage.c | 2 +- include/linux/hugetlb.h | 3 +++ mm/migrate.c | 6 +++++- mm/mprotect.c | 8 +++++++- mm/page_vma_mapped.c | 8 +++++++- mm/rmap.c | 32 ++++++++++++++++++++------------ 6 files changed, 43 insertions(+), 16 deletions(-) -- 2.43.0