Re: [PATCH v3] kasan: Don't call find_vm_area() in RT kernel
From: Andrey Konovalov
Date: Mon Feb 17 2025 - 13:59:56 EST
On Mon, Feb 17, 2025 at 6:56 PM Waiman Long <llong@xxxxxxxxxx> wrote:
>
> >> + */
> >> +static inline void print_vmalloc_info_set_page(void *addr, struct page **ppage)
> >> +{
> >> + if (!IS_ENABLED(CONFIG_PREEMPT_RT)) {
> >> + static DEFINE_WAIT_OVERRIDE_MAP(vmalloc_map, LD_WAIT_SLEEP);
> >> + struct vm_struct *va;
> >> +
> >> + lock_map_acquire_try(&vmalloc_map);
> >> + va = find_vm_area(addr);
> >> + if (va) {
> >> + pr_err("The buggy address belongs to the virtual mapping at\n"
> >> + " [%px, %px) created by:\n"
> >> + " %pS\n",
> >> + va->addr, va->addr + va->size, va->caller);
> >> + pr_err("\n");
> >> +
> >> + *ppage = vmalloc_to_page(addr);
> > Looking at the code again, I actually like the Andrey Ryabinin's
> > suggestion from the v1 thread: add a separate function that contains
> > an annotated call of find_vm_area(). And keep vmalloc_to_page()
> > outside of it, just as done in the upstream version now.
>
> I can make the change if it is what you want.
Yes, please, I think splitting out the call that requires an
annotation into a separate function makes sense.