Re: [PATCH 2/2] arm64/mm: Update create_kpti_ng_temp_pgd() to handle pgtable_alloc failure

From: David Hildenbrand
Date: Tue Aug 19 2025 - 03:41:56 EST


On 13.08.25 16:56, Chaitanya S Prakash wrote:
create_kpti_ng_temp_pgd() was created as an alias for void returning
__create_pgd_mapping_locked() and relied on pgtable_alloc() to BUG_ON()
if an allocation failure occurred. But as __create_pgd_mapping_locked()
has been updated as a part of the error propagation patch to return a
non-void value, update create_kpti_ng_temp_pgd() to act as a wrapper
around __create_pgd_mapping_locked() and BUG_ON() on ret being a non
zero value.

If my memory serves me right, panic() is preferred in such unexpected early-boot scenarios (BUG_ON is frowned upon), where you can actually print what is going wrong.


Which raises the question: could create_kpti_ng_temp_pgd() be __init? __kpti_install_ng_mappings(), the only caller, seems to be.

--
Cheers

David / dhildenb