linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Andrew Donnellan <ajd@linux.ibm.com>
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Madhavan Srinivasan <maddy@linux.ibm.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	Rohan McLure <rmclure@nvidia.com>,
	Christophe Leroy <chleroy@kernel.org>,
	Alexandre Ghiti <alex@ghiti.fr>,
	x86@kernel.org, Nicholas Miehlbradt <nicholas@linux.ibm.com>,
	Sweet Tea Dorminy <sweettea-kernel@dorminy.me>,
	Andrew Donnellan <andrew+kernel@donnellan.id.au>,
	Srish Srinivasan <ssrish@linux.ibm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: Re: [PATCH v18 10/12] powerpc/mm: Implement *_user_accessible_page() for ptes
Date: Tue, 27 Jan 2026 16:51:36 +0100	[thread overview]
Message-ID: <20260127155136.2808076Add-agordeev@linux.ibm.com> (raw)
In-Reply-To: <20251219-pgtable_check_v18rebase-v18-10-755bc151a50b@linux.ibm.com>

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!


  reply	other threads:[~2026-01-27 15:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 17:09 [PATCH v18 00/12] Support page table check on PowerPC Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 01/12] arm64/mm: Add addr parameter to __set_ptes_anysz() Andrew Donnellan
2025-12-18 17:49   ` Pasha Tatashin
2025-12-18 17:09 ` [PATCH v18 02/12] arm64/mm: Add addr parameter to __ptep_get_and_clear_anysz() Andrew Donnellan
2025-12-18 17:49   ` Pasha Tatashin
2025-12-18 17:09 ` [PATCH v18 03/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud[s]_set() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 04/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd[s]_set() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 05/12] mm/page_table_check: Provide addr parameter to page_table_check_ptes_set() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 06/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pud_clear() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 07/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pmd_clear() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 08/12] mm/page_table_check: Reinstate address parameter in [__]page_table_check_pte_clear() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 09/12] mm: Provide address parameter to p{te,md,ud}_user_accessible_page() Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 10/12] powerpc/mm: Implement *_user_accessible_page() for ptes Andrew Donnellan
2026-01-27 15:51   ` Alexander Gordeev [this message]
2025-12-18 17:09 ` [PATCH v18 11/12] powerpc/mm: Use set_pte_at_unchecked() for internal usages Andrew Donnellan
2025-12-18 17:09 ` [PATCH v18 12/12] powerpc/mm: Support page table check Andrew Donnellan
2025-12-18 17:55 ` [PATCH v18 00/12] Support page table check on PowerPC Pasha Tatashin
2026-01-14  5:00   ` Andrew Donnellan
2026-01-14  9:34     ` Christophe Leroy (CS GROUP)
2026-01-15  6:13       ` Andrew Donnellan
2026-01-16  0:18         ` Andrew Morton
2026-01-16  3:13           ` Andrew Donnellan
2026-02-20  4:10 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260127155136.2808076Add-agordeev@linux.ibm.com \
    --to=agordeev@linux.ibm.com \
    --cc=ajd@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=andrew+kernel@donnellan.id.au \
    --cc=chleroy@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=nicholas@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=rmclure@nvidia.com \
    --cc=ssrish@linux.ibm.com \
    --cc=sweettea-kernel@dorminy.me \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox