[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZcMpi6sUW2ksd_r1D78D8qnKag41HNYCHz=HM1-DL71jg@mail.gmail.com>
Date: Thu, 10 Jul 2025 14:43:15 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Yeoreum Yun <yeoreum.yun@....com>, akpm@...ux-foundation.org
Cc: glider@...gle.com, dvyukov@...gle.com, vincenzo.frascino@....com,
bigeasy@...utronix.de, clrkwllms@...nel.org, rostedt@...dmis.org,
byungchul@...com, max.byungchul.park@...il.com, ysk@...lloc.com,
kasan-dev@...glegroups.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
linux-rt-devel@...ts.linux.dev
Subject: Re: [PATCH v2] kasan: remove kasan_find_vm_area() to prevent possible deadlock
On Thu, Jul 3, 2025 at 8:10 PM Yeoreum Yun <yeoreum.yun@....com> wrote:
>
> find_vm_area() couldn't be called in atomic_context.
> If find_vm_area() is called to reports vm area information,
> kasan can trigger deadlock like:
>
> CPU0 CPU1
> vmalloc();
> alloc_vmap_area();
> spin_lock(&vn->busy.lock)
> spin_lock_bh(&some_lock);
> <interrupt occurs>
> <in softirq>
> spin_lock(&some_lock);
> <access invalid address>
> kasan_report();
> print_report();
> print_address_description();
> kasan_find_vm_area();
> find_vm_area();
> spin_lock(&vn->busy.lock) // deadlock!
>
> To prevent possible deadlock while kasan reports, remove kasan_find_vm_area().
>
> Fixes: c056a364e954 ("kasan: print virtual mapping info in reports")
> Reported-by: Yunseong Kim <ysk@...lloc.com>
> Signed-off-by: Yeoreum Yun <yeoreum.yun@....com>
As a fix:
Acked-by: Andrey Konovalov <andreyknvl@...il.com>
But it would be great to figure out a way to eventually restore this
functionality; I'll file a bug for this once this patch lands. The
virtual mapping info helps with real issues: e.g. just recently it
helped me to quickly see the issue that caused a false-positive report
[1].
[1] https://lore.kernel.org/all/CA+fCnZfzHOFjVo43UZK8H6h3j=OHjfF13oFJvT0P-SM84Oc4qQ@mail.gmail.com/
Powered by blists - more mailing lists