From nobody Fri Dec 19 19:02:45 2025 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 2D55628489E for ; Thu, 18 Dec 2025 17:10:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766077836; cv=none; b=tTNUl1LEMnwDEQfQ+McrA9eAkQgidWk3r8XGp8H71ZGSM7ZtJ+fC2mGf4+chdwXaqvGsYsR0gV8B+C4+QbFIA8UIpaue3rUlUAue6iOD8zhVyjwGF2/tTlQKvZu+MstawcUQWzp7MmWIUd6jXZS4k6gzV/NmoISAOzzxdg+LuTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766077836; c=relaxed/simple; bh=SpV6sgszvtOnm/PBrnu07nnlNU7UqQ2gDfyq97bHirQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sxTO5wDlEyovXS5RITctEsdeY+pmn+nUODOuPH8r7TEP1WyWf0F1NC8bk6NLKZWzZNVqZSW8kKb9PklKInywMb4ExpYV98WvSZFq8lHOGPgDuMIN3a7kPv0mtL7GuRC3gw+Ct7C/S41EHiXitm9b9Oav9tOCeodhkK6FJvtB8H0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=QuX+sM1t; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QuX+sM1t" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5BI8lli9012517; Thu, 18 Dec 2025 17:10:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=SskiqX uzbr2amJlbHojQ/YH/pndNtq7FvgJs906bqOo=; b=QuX+sM1tuFeaV/ZQB+C4MO 636rwLmiaP2/qrsBwuOmA/Jn9GV+wDtUOTUz9zZvtEr0CdbnfhnJ9neej9KxvokQ 5mnaaBxvjRpgUkU3WBa+U89gKJXZMbm/qUujS45YCA7VSsyJ71Hbdu157QUrK+zm CtyFE8gZyQEF2GD/3/bXhTF6dtGWp2VSAQ2PDbrs2tu0/OoeWh1ssE2R7DPkOjaQ FZJbl3+w/4h+vPq0X5og1CGG0Wa7OARxFdhPzLvWvT/Y0qSXPqKm7ADb2DlQZBeM 4O5SFKmA2GAcF/38YVNa6A5mkc0wbfg3F7epxDoU8SEJq1mVZbZsbdPXw+oNw0TQ == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4b0yn8uyt4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Dec 2025 17:10:17 +0000 (GMT) Received: from m0360083.ppops.net (m0360083.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5BIHAGkV016082; Thu, 18 Dec 2025 17:10:16 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4b0yn8uysx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Dec 2025 17:10:16 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5BIEUBG0002863; Thu, 18 Dec 2025 17:10:15 GMT Received: from smtprelay07.wdc07v.mail.ibm.com ([172.16.1.74]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4b1kfnhhr3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 18 Dec 2025 17:10:15 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay07.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5BIHADsA26542786 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 18 Dec 2025 17:10:13 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6F7395805A; Thu, 18 Dec 2025 17:10:13 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7692958064; Thu, 18 Dec 2025 17:10:06 +0000 (GMT) Received: from jarvis.ozlabs.ibm.com (unknown [9.36.16.51]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Thu, 18 Dec 2025 17:10:06 +0000 (GMT) From: Andrew Donnellan Date: Fri, 19 Dec 2025 04:09:35 +1100 Subject: [PATCH v18 03/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud[s]_set() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251219-pgtable_check_v18rebase-v18-3-755bc151a50b@linux.ibm.com> References: <20251219-pgtable_check_v18rebase-v18-0-755bc151a50b@linux.ibm.com> In-Reply-To: <20251219-pgtable_check_v18rebase-v18-0-755bc151a50b@linux.ibm.com> To: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Pasha Tatashin , Andrew Morton , Madhavan Srinivasan , Nicholas Piggin , Rohan McLure , Christophe Leroy Cc: Alexandre Ghiti , x86@kernel.org, Nicholas Miehlbradt , Sweet Tea Dorminy , Andrew Donnellan , Srish Srinivasan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org X-Mailer: b4 0.14.2 X-TM-AS-GCONF: 00 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjEzMDAxOCBTYWx0ZWRfX5MxHRb0I5nH6 3Mb03RBXSENeftYsd20Cd/h6/vASGtB0WEblavnxC96qaOvJrQXyy0YmXAeIif7rQ2LE4VWVfBe Nt7ikfqPvJYlDJ5Bd/KMGw8yDzur6OY67w99ZctpkYR4U4iRmp8PaCkg/Pbv87ce4ucM7F/VtIT 1tegR6DIognFTmKdeUYTdyjWVi2I2HHItHsHJ2NWXWERK69MybTsrDvygvzkCor1R2WPlqNI5QP KuiSsPFC5vSivee+qwiVTXSOij6HeXVRFE6zEbwnjP/nhG+51reg3tZC95yIcpkotV+i0i2PRrH f6ug4/JcBUkuxhi1dA8Wdd04wln57bf/b5PqYiGUuVjQSXlNqcg9HHA0wzP+Mk1mOs/MuBwmVkI 9U2Msm/tem/w/LN9Cp6CsPS6dEOxoA== X-Proofpoint-GUID: GgX4_szkJA6yTTm0B-gwoI7WWvTHXwg8 X-Proofpoint-ORIG-GUID: riEKCtJc0a_Nv3It3u3dYPsN-a7NeUG_ X-Authority-Analysis: v=2.4 cv=LbYxKzfi c=1 sm=1 tr=0 ts=69443579 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=7ipKWUHlAAAA:8 a=VwQbUJbxAAAA:8 a=h0uksLzaAAAA:8 a=3Toew5EgkJ5X0DR0WCAA:9 a=QEXdDO2ut3YA:10 a=gpc5p9EgBqZVLdJeV_V1:22 a=MSi_79tMYmZZG2gvAgS0:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-12-18_02,2025-12-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 phishscore=0 clxscore=1015 suspectscore=0 adultscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2512130018 From: Rohan McLure This reverts commit 6d144436d954 ("mm/page_table_check: remove unused parameter in [__]page_table_check_pud_set"). Reinstate previously unused parameters for the purpose of supporting powerpc platforms, as many do not encode user/kernel ownership of the page in the pte, but instead in the address of the access. Apply this to __page_table_check_puds_set(), page_table_check_puds_set() and the page_table_check_pud_set() wrapper macro. [ajd@linux.ibm.com: rebase on riscv + arm64 changes, update commit message] Signed-off-by: Rohan McLure Reviewed-by: Pasha Tatashin Acked-by: Ingo Molnar # x86 Acked-by: Alexandre Ghiti # riscv Signed-off-by: Andrew Donnellan --- v13: remove inaccurate comment on riscv in the commit message v14: fix an x86 usage I missed (found by akpm) v15: rebase, amend commit message --- arch/arm64/include/asm/pgtable.h | 3 ++- arch/riscv/include/asm/pgtable.h | 4 ++-- arch/x86/include/asm/pgtable.h | 4 ++-- include/linux/page_table_check.h | 12 ++++++------ mm/page_table_check.c | 4 ++-- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgta= ble.h index 29f7ae7011a820687f5b1e2fdc782eb37f85fc1b..87ed9b1c011e167125a7f29a338= 8eca4c7bd9f29 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -688,7 +688,8 @@ static inline void __set_ptes_anysz(struct mm_struct *m= m, unsigned long addr, break; #ifndef __PAGETABLE_PMD_FOLDED case PUD_SIZE: - page_table_check_puds_set(mm, (pud_t *)ptep, pte_pud(pte), nr); + page_table_check_puds_set(mm, addr, (pud_t *)ptep, + pte_pud(pte), nr); break; #endif default: diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgta= ble.h index 8bd36ac842eba94ec6af140ab81bd75d32ad1ff8..c4ea70903fedac7c055fb4cf530= 000a533c27ade 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -951,7 +951,7 @@ static inline void set_pmd_at(struct mm_struct *mm, uns= igned long addr, static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(mm, pudp, pud); + page_table_check_pud_set(mm, addr, pudp, pud); return __set_pte_at(mm, (pte_t *)pudp, pud_pte(pud)); } =20 @@ -1114,7 +1114,7 @@ static inline void update_mmu_cache_pud(struct vm_are= a_struct *vma, static inline pud_t pudp_establish(struct vm_area_struct *vma, unsigned long address, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(vma->vm_mm, pudp, pud); + page_table_check_pud_set(vma->vm_mm, address, pudp, pud); return __pud(atomic_long_xchg((atomic_long_t *)pudp, pud_val(pud))); } =20 diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h index 2842fa1f7a2ce2346c51f76470a0902155d7d00d..2b540c563d8ddc5ed28e583de6a= 409c0e1bd97aa 100644 --- a/arch/x86/include/asm/pgtable.h +++ b/arch/x86/include/asm/pgtable.h @@ -1221,7 +1221,7 @@ static inline void set_pmd_at(struct mm_struct *mm, u= nsigned long addr, static inline void set_pud_at(struct mm_struct *mm, unsigned long addr, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(mm, pudp, pud); + page_table_check_pud_set(mm, addr, pudp, pud); native_set_pud(pudp, pud); } =20 @@ -1372,7 +1372,7 @@ static inline pmd_t pmdp_establish(struct vm_area_str= uct *vma, static inline pud_t pudp_establish(struct vm_area_struct *vma, unsigned long address, pud_t *pudp, pud_t pud) { - page_table_check_pud_set(vma->vm_mm, pudp, pud); + page_table_check_pud_set(vma->vm_mm, address, pudp, pud); if (IS_ENABLED(CONFIG_SMP)) { return xchg(pudp, pud); } else { diff --git a/include/linux/page_table_check.h b/include/linux/page_table_ch= eck.h index 289620d4aad3a03a0c3b27b08066fb27250cd10a..0bf18b884a1265fa98eb04d2e3d= bd63d02e706f3 100644 --- a/include/linux/page_table_check.h +++ b/include/linux/page_table_check.h @@ -21,8 +21,8 @@ void __page_table_check_ptes_set(struct mm_struct *mm, pt= e_t *ptep, pte_t pte, unsigned int nr); void __page_table_check_pmds_set(struct mm_struct *mm, pmd_t *pmdp, pmd_t = pmd, unsigned int nr); -void __page_table_check_puds_set(struct mm_struct *mm, pud_t *pudp, pud_t = pud, - unsigned int nr); +void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr, + pud_t *pudp, pud_t pud, unsigned int nr); void __page_table_check_pte_clear_range(struct mm_struct *mm, unsigned long addr, pmd_t pmd); @@ -86,12 +86,12 @@ static inline void page_table_check_pmds_set(struct mm_= struct *mm, } =20 static inline void page_table_check_puds_set(struct mm_struct *mm, - pud_t *pudp, pud_t pud, unsigned int nr) + unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr) { if (static_branch_likely(&page_table_check_disabled)) return; =20 - __page_table_check_puds_set(mm, pudp, pud, nr); + __page_table_check_puds_set(mm, addr, pudp, pud, nr); } =20 static inline void page_table_check_pte_clear_range(struct mm_struct *mm, @@ -137,7 +137,7 @@ static inline void page_table_check_pmds_set(struct mm_= struct *mm, } =20 static inline void page_table_check_puds_set(struct mm_struct *mm, - pud_t *pudp, pud_t pud, unsigned int nr) + unsigned long addr, pud_t *pudp, pud_t pud, unsigned int nr) { } =20 @@ -150,6 +150,6 @@ static inline void page_table_check_pte_clear_range(str= uct mm_struct *mm, #endif /* CONFIG_PAGE_TABLE_CHECK */ =20 #define page_table_check_pmd_set(mm, pmdp, pmd) page_table_check_pmds_set(= mm, pmdp, pmd, 1) -#define page_table_check_pud_set(mm, pudp, pud) page_table_check_puds_set(= mm, pudp, pud, 1) +#define page_table_check_pud_set(mm, addr, pudp, pud) page_table_check_pud= s_set(mm, addr, pudp, pud, 1) =20 #endif /* __LINUX_PAGE_TABLE_CHECK_H */ diff --git a/mm/page_table_check.c b/mm/page_table_check.c index 741884645ab0fdd49425098681d62070c343152b..a48f835216a1f50ffd088477ae7= e80896be43bc6 100644 --- a/mm/page_table_check.c +++ b/mm/page_table_check.c @@ -243,8 +243,8 @@ void __page_table_check_pmds_set(struct mm_struct *mm, = pmd_t *pmdp, pmd_t pmd, } EXPORT_SYMBOL(__page_table_check_pmds_set); =20 -void __page_table_check_puds_set(struct mm_struct *mm, pud_t *pudp, pud_t = pud, - unsigned int nr) +void __page_table_check_puds_set(struct mm_struct *mm, unsigned long addr, + pud_t *pudp, pud_t pud, unsigned int nr) { unsigned long stride =3D PUD_SIZE >> PAGE_SHIFT; unsigned int i; --=20 2.52.0