Re: [PATCH v2] kasan: fix runtime shadow page table synchronization

From: Jose A. Perez de Azpillaga

Date: Sun Oct 18 2026 - 04:48:40 EST


On 10/18/26 6:35 AM, Muchun Song wrote:
> - if (IS_ALIGNED(addr, PMD_SIZE) && end - addr >= PMD_SIZE) {
> + if (IS_ALIGNED(addr, PMD_SIZE) && end - addr >= PMD_SIZE &&
> + pmd_none(*pmd)) {
> pmd_populate_kernel(&init_mm, pmd,
> lm_alias(kasan_early_shadow_pte));

what if the entry already points at the early shadow table? this walks
down into it then, which loongarch does on every boot.

[snip]

> - zero_pmd_populate(pud, addr, next);
> + ret = zero_pmd_populate(pud, addr, next, mask);
> + if (ret)
> + return ret;

isn't this a separate fix? it's not in the changelog.

[snip]

> if (kasan_pud_table(*p4d)) {
> + if (ARCH_PAGE_TABLE_SYNC_MASK & PGTBL_P4D_MODIFIED)
> + continue;
> +

doesn't this leave the range on the zero shadow, which memory onlined
there later then keeps? would always allocating a table at the synced
level once slab is up avoid that?

--
cheers,
jose a. p-a