Re: [PATCH v2 1/3] kasan: Avoid sleepable page allocation from atomic context

From: Alexander Gordeev
Date: Thu Apr 10 2025 - 11:20:29 EST


On Wed, Apr 09, 2025 at 04:56:29PM +0200, Andrey Ryabinin wrote:

Hi Andrey,

...
> >>> - page = __get_free_page(GFP_KERNEL);
> >>> + page = __get_free_page(GFP_ATOMIC);
> >>> if (!page)
> >> 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().
>
> We'll need to pass it as 'struct page **page' or maybe as pointer to some struct, e.g.:
> struct page_data {
> struct page *page;
> };
...

Thanks for the hint! I will try to implement that, but will likely start
in two weeks, after I am back from vacation.

Not sure wether this version needs to be dropped.

Thanks!