]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
powerpc/64s/radix: Fix huge vmap false positive
authorNicholas Piggin <npiggin@gmail.com>
Thu, 16 Dec 2021 10:33:42 +0000 (20:33 +1000)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 10:03:10 +0000 (11:03 +0100)
commit6cb9f28f641b2bfac665a50506ec9318a7764e08
treed0b8869f0930cc11b1581bcc1e67d81ed71ac665
parentfa4b2b33bd248b4cd8cc6f39ce004547ffeb4b36
powerpc/64s/radix: Fix huge vmap false positive

BugLink: https://bugs.launchpad.net/bugs/1959376
commit 467ba14e1660b52a2f9338b484704c461bd23019 upstream.

pmd_huge() is defined to false when HUGETLB_PAGE is not configured, but
the vmap code still installs huge PMDs. This leads to false bad PMD
errors when vunmapping because it is not seen as a huge PTE, and the bad
PMD check catches it. The end result may not be much more serious than
some bad pmd warning messages, because the pmd_none_or_clear_bad() does
what we wanted and clears the huge PTE anyway.

Fix this by checking pmd_is_leaf(), which checks for a PTE regardless of
config options. The whole huge/large/leaf stuff is a tangled mess but
that's kernel-wide and not something we can improve much in arch/powerpc
code.

pmd_page(), pud_page(), etc., called by vmalloc_to_page() on huge vmaps
can similarly trigger a false VM_BUG_ON when CONFIG_HUGETLB_PAGE=n, so
those checks are adjusted. The checks were added by commit d6eacedd1f0e
("powerpc/book3s: Use config independent helpers for page table walk"),
while implementing a similar fix for other page table walking functions.

Fixes: d909f9109c30 ("powerpc/64s/radix: Enable HAVE_ARCH_HUGE_VMAP")
Cc: stable@vger.kernel.org # v5.3+
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211216103342.609192-1-npiggin@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
arch/powerpc/mm/book3s64/radix_pgtable.c
arch/powerpc/mm/pgtable_64.c