diff mbox series

[-next,2/2] arm64/mm: fix page table check compile error for CONFIG_PGTABLE_LEVELS=2

Message ID 20220517074548.2227779-3-tongtiangen@huawei.com (mailing list archive)
State New, archived
Headers show
Series mm: fix some page table check related issues | expand

Commit Message

Tong Tiangen May 17, 2022, 7:45 a.m. UTC
If CONFIG_PGTABLE_LEVELS=2 and CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y,
then we trigger a compile error:

  error: implicit declaration of function 'pte_user_accessible_page'

Move the definition of page table check helper out of branch
CONFIG_PGTABLE_LEVELS > 2

Fixes: daf214c14dbe ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK")
Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
---
 arch/arm64/include/asm/pgtable.h | 33 ++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

Comments

Catalin Marinas May 18, 2022, 4:28 p.m. UTC | #1
On Tue, May 17, 2022 at 07:45:48AM +0000, Tong Tiangen wrote:
> If CONFIG_PGTABLE_LEVELS=2 and CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y,
> then we trigger a compile error:
> 
>   error: implicit declaration of function 'pte_user_accessible_page'
> 
> Move the definition of page table check helper out of branch
> CONFIG_PGTABLE_LEVELS > 2
> 
> Fixes: daf214c14dbe ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK")
> Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>

I'd drop the fixes tag here since the patch is queued in the mm tree and
AFAIK that one doesn't have stable git commit ids. Otherwise:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

(I cc'ed Andrew and linux-mm as Andrew queued the original patches)
Andrew Morton May 18, 2022, 5:13 p.m. UTC | #2
On Wed, 18 May 2022 17:28:38 +0100 Catalin Marinas <catalin.marinas@arm.com> wrote:

> On Tue, May 17, 2022 at 07:45:48AM +0000, Tong Tiangen wrote:
> > If CONFIG_PGTABLE_LEVELS=2 and CONFIG_ARCH_SUPPORTS_PAGE_TABLE_CHECK=y,
> > then we trigger a compile error:
> > 
> >   error: implicit declaration of function 'pte_user_accessible_page'
> > 
> > Move the definition of page table check helper out of branch
> > CONFIG_PGTABLE_LEVELS > 2
> > 
> > Fixes: daf214c14dbe ("arm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK")
> > Signed-off-by: Tong Tiangen <tongtiangen@huawei.com>
> 
> I'd drop the fixes tag here since the patch is queued in the mm tree and
> AFAIK that one doesn't have stable git commit ids.

MM tree is at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Commit ID's are stable if a commit is in the mm-hotfixes-stable,
mm-stable or mm-nonmm-stable branch.

Commit ID's are unstable if a commit is still in the
mm-hotfixes-unstable, mm-unstable or mm-unnonmm-stable.

I move patches from -unstable to -stable after they're considered ready
for it.  The delay is very variable, depends on how things are coming
along with that patch(set).
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index 4e61cde27f9f..979601528f1e 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -667,22 +667,6 @@  static inline unsigned long pmd_page_vaddr(pmd_t pmd)
 #define pud_valid(pud)		pte_valid(pud_pte(pud))
 #define pud_user(pud)		pte_user(pud_pte(pud))
 
-#ifdef CONFIG_PAGE_TABLE_CHECK
-static inline bool pte_user_accessible_page(pte_t pte)
-{
-	return pte_present(pte) && (pte_user(pte) || pte_user_exec(pte));
-}
-
-static inline bool pmd_user_accessible_page(pmd_t pmd)
-{
-	return pmd_present(pmd) && (pmd_user(pmd) || pmd_user_exec(pmd));
-}
-
-static inline bool pud_user_accessible_page(pud_t pud)
-{
-	return pud_present(pud) && pud_user(pud);
-}
-#endif
 
 static inline void set_pud(pud_t *pudp, pud_t pud)
 {
@@ -855,6 +839,23 @@  static inline int pgd_devmap(pgd_t pgd)
 }
 #endif
 
+#ifdef CONFIG_PAGE_TABLE_CHECK
+static inline bool pte_user_accessible_page(pte_t pte)
+{
+	return pte_present(pte) && (pte_user(pte) || pte_user_exec(pte));
+}
+
+static inline bool pmd_user_accessible_page(pmd_t pmd)
+{
+	return pmd_present(pmd) && (pmd_user(pmd) || pmd_user_exec(pmd));
+}
+
+static inline bool pud_user_accessible_page(pud_t pud)
+{
+	return pud_present(pud) && pud_user(pud);
+}
+#endif
+
 /*
  * Atomic pte/pmd modifications.
  */