On Wed, Apr 09, 2025 at 04:10:58PM +0200, Andrey Ryabinin wrote:

Hi Andrey,

> > @@ -301,7 +301,7 @@ static int kasan_populate_vmalloc_pte(pte_t *ptep, 
> > unsigned long addr,
> >     if (likely(!pte_none(ptep_get(ptep))))
> >             return 0;
> >  
> > -   page = __get_free_page(GFP_KERNEL);
> > +   page = __get_free_page(GFP_ATOMIC);
> >     if (!page)
> >             return -ENOMEM;
> >  
> 
> I think a better way to fix this would be moving out allocation from atomic 
> context. Allocate page prior
> to apply_to_page_range() call and pass it down to 
> kasan_populate_vmalloc_pte().

I think the page address could be passed as the parameter to 
kasan_populate_vmalloc_pte().

> Whenever kasan_populate_vmalloc_pte() will require additional page we could 
> bail out with -EAGAIN,
> and allocate another one.

When would it be needed? kasan_populate_vmalloc_pte() handles just one page.

Thanks!

Reply via email to