[PATCH] riscv: check leaf entry alignment in pageattr_pxd_entry()

Paul Walmsley pjw at kernel.org
Fri May 22 16:34:41 PDT 2026


Hi Austin,

On Mon, 20 Apr 2026, Austin Kim wrote:

> During page table walking, ensure the range being processed matches
> the expected size of a leaf entry (P4D, PUD, or PMD). While pxd_addr_end() 
> functions handle boundary checks, they do not inherently validate whether 
> the entry is a leaf node of the expected size.
> 
> Add WARN_ON_ONCE() to detect misalignments or partial updates of huge 
> pages. If a mismatch is detected, return -EINVAL to prevent potential
> corruption of page table entries.
> 
> Signed-off-by: Austin Kim <austindh.kim at gmail.com>

Is this in response to a failure mode that you've seen?  Or is it simply 
prophylactic?

Seems like a better place for this might be in common code, so other 
architectures could benefit as well?


- Paul



More information about the linux-riscv mailing list