Re: Crash on armv7-a using KASAN

From: Clement LE GOFFIC
Date: Tue Oct 15 2024 - 06:38:12 EST


On 10/15/24 09:55, Linus Walleij wrote:> On Mon, Oct 14, 2024 at 3:21 PM Clement LE GOFFIC
<clement.legoffic@xxxxxxxxxxx> wrote:

I have detected a kernel crash in latest kernel on armv7-a when Kasan is
enabled.
(...)
Crash log with recent kernel (v6.12-rc3) :

~ # Insufficient stack space to handle exception!

The crash looks pretty "expected", as you say you start a lot of
parallel processes
and whoops, you run out of memory on the stack. No software can add more
memory to the machine.

KASAN uses a lot of extra memory for intercepting all memory accesses,
nominally one
extra byte per 8 bytes. This is further restricted by the complex
nature of the virtual
memory space on ARM32.

That said, we increase the size of per-thread storage when using KASAN,
THREAD_SIZE_ORDER is 2 instead of 1. Maybe the interrupt stacks need
to be scaled similarly to manage the increased load?

Hi Linus,

Thanks for your reply.

Once I found the issue in latest kernel, with Antonio we firstly tried to increase the stack size, but it kept crashing.

Then we identified the offending commit and we noticed that it does not change at all the stack layout.
In fact Ard patch only modifies the way to unwind frames for backtrace.

As far as we understand, KASAN enabled causes the generation of several backtraces (hashed) on alloc and free to track all the allocation.
The offending commit seams responsible of the crash due to incorrect unwind.

Best regards,

Clément