Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "arm64/mm: Drop redundant BUG_ON(!pgtable_alloc)"

This reverts commit 9ed2b4616d4e846ece2a04cb5007ce1d1bd9e3f3.

Nathan reports early boot failures bisected to this change which look
related to the kPTI nG repainting. In any case, consolidating the
BUG_ON()s to a single location needs more thought, so revert the change
until this is figured out properly.

Link: https://lore.kernel.org/r/Y3pS5fdZ3MdLZ00t@dev-arch.thelio-3990X
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Will Deacon <will@kernel.org>

+3 -1
+3 -1
arch/arm64/mm/mmu.c
··· 207 207 208 208 if (flags & NO_EXEC_MAPPINGS) 209 209 pmdval |= PMD_TABLE_PXN; 210 + BUG_ON(!pgtable_alloc); 210 211 pte_phys = pgtable_alloc(PAGE_SHIFT); 211 212 __pmd_populate(pmdp, pte_phys, pmdval); 212 213 pmd = READ_ONCE(*pmdp); ··· 285 284 286 285 if (flags & NO_EXEC_MAPPINGS) 287 286 pudval |= PUD_TABLE_PXN; 287 + BUG_ON(!pgtable_alloc); 288 288 pmd_phys = pgtable_alloc(PMD_SHIFT); 289 289 __pud_populate(pudp, pmd_phys, pudval); 290 290 pud = READ_ONCE(*pudp); ··· 324 322 325 323 if (flags & NO_EXEC_MAPPINGS) 326 324 p4dval |= P4D_TABLE_PXN; 325 + BUG_ON(!pgtable_alloc); 327 326 pud_phys = pgtable_alloc(PUD_SHIFT); 328 327 __p4d_populate(p4dp, pud_phys, p4dval); 329 328 p4d = READ_ONCE(*p4dp); ··· 383 380 phys &= PAGE_MASK; 384 381 addr = virt & PAGE_MASK; 385 382 end = PAGE_ALIGN(virt + size); 386 - BUG_ON(!pgtable_alloc); 387 383 388 384 do { 389 385 next = pgd_addr_end(addr, end);