Re: [PATCH] mm: kfence: fix handling discontiguous page

From: Muchun Song
Date: Thu Mar 23 2023 - 21:59:58 EST




> On Mar 24, 2023, at 06:18, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 23 Mar 2023 10:50:03 +0800 Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote:
>
>> The struct pages could be discontiguous when the kfence pool is allocated
>> via alloc_contig_pages() with CONFIG_SPARSEMEM and !CONFIG_SPARSEMEM_VMEMMAP.
>> So, the iteration should use nth_page().
>
> What are the user-visible runtime effects of this flaw?

Set the PG_slab and memcg_data to a arbitrary address (may be not used as a struct
page), so the worst case may corrupt the kernel.

Thanks.

>
> Thanks.