Re: [PATCH 1/3] x86/mm/ident_map: Fix virtual address wrap to zero
From: Huang, Kai
Date: Wed Jul 03 2024 - 06:14:12 EST
On Mon, 2024-07-01 at 15:43 +0300, Kirill A. Shutemov wrote:
> Calculation of 'next' virtual address doesn't protect against wrapping
> to zero. It can result in page table corruption and hang. The
> problematic case is possible if user sets high x86_mapping_info::offset.
>
> Replace manual 'next' calculation with p?d_addr_and() which handles
p?d_addr_and() -> p?d_addr_end().
> wrapping correctly.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Reviewed-by: Kai Huang <kai.huang@xxxxxxxxx>