[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260127155136.2808076Add-agordeev@linux.ibm.com>
Date: Tue, 27 Jan 2026 16:51:36 +0100
From: Alexander Gordeev <agordeev@...ux.ibm.com>
To: Andrew Donnellan <ajd@...ux.ibm.com>
Cc: linux-mm@...ck.org, linuxppc-dev@...ts.ozlabs.org,
Pasha Tatashin <pasha.tatashin@...een.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>, Rohan McLure <rmclure@...dia.com>,
Christophe Leroy <chleroy@...nel.org>, Alexandre Ghiti <alex@...ti.fr>,
x86@...nel.org, Nicholas Miehlbradt <nicholas@...ux.ibm.com>,
Sweet Tea Dorminy <sweettea-kernel@...miny.me>,
Andrew Donnellan <andrew+kernel@...nellan.id.au>,
Srish Srinivasan <ssrish@...ux.ibm.com>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v18 10/12] powerpc/mm: Implement *_user_accessible_page()
for ptes
On Fri, Dec 19, 2025 at 04:09:42AM +1100, Andrew Donnellan wrote:
Hi All,
...
> Page table checking depends on architectures providing an
> implementation of p{te,md,ud}_user_accessible_page.
...
> +static inline bool pte_user_accessible_page(pte_t pte, unsigned long addr)
> +{
> + return pte_present(pte) && !is_kernel_addr(addr);
> +}
We looked into implementing this for s390 and for us the only possible
user vs kernel entry attribute is comparing mm to init_mm. The generic
code already does that, but I am not sure whether such check alone is
enough.
But it occured to me that we could implement e.g. ARCH_SUPPORTS_PTC_USER_PAGE
that adds an extra field to struct page_table_check:
struct page_table_check {
atomic_t anon_map_count;
atomic_t file_map_count;
#ifdef CONFIG_ARCH_SUPPORTS_PTC_USER_PAGE
bool user_page;
#endif
};
Page Table Extensions already used by PTC, so that would fit pretty natural.
Once a page is mapped into a user process it would be marked as user_page,
while p{te,md,ud}_user_accessible_page() could go generic:
static inline bool pte_user_accessible_page(pte_t pte, unsigned long addr)
{
return pte_present(pte) && page_table_check_is_user_page(pte);
}
...
I guess, many architectures without viable p.._user() support could benefit
from that.
But I am not sure whether is it doable, so opinions are very welcomed!
Thanks!
Powered by blists - more mailing lists