Re: [PATCH v3] mm/kasan: Print frame description for stack bugs

From: Andrey Ryabinin
Date: Wed May 22 2019 - 08:21:56 EST


On 5/22/19 1:00 PM, Marco Elver wrote:
> This adds support for printing stack frame description on invalid stack
> accesses. The frame description is embedded by the compiler, which is
> parsed and then pretty-printed.
>
> Currently, we can only print the stack frame info for accesses to the
> task's own stack, but not accesses to other tasks' stacks.
>
> Example of what it looks like:
>
> [ 17.924050] page dumped because: kasan: bad access detected
> [ 17.924908]
> [ 17.925153] addr ffff8880673ef98a is located in stack of task insmod/2008 at offset 106 in frame:
> [ 17.926542] kasan_stack_oob+0x0/0xf5 [test_kasan]
> [ 17.927932]
> [ 17.928206] this frame has 2 objects:
> [ 17.928783] [32, 36) 'i'
> [ 17.928784] [96, 106) 'stack_array'
> [ 17.929216]
> [ 17.930031] Memory state around the buggy address:
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=198435
> Signed-off-by: Marco Elver <elver@xxxxxxxxxx>

Reviewed-by: Andrey Ryabinin <aryabinin@xxxxxxxxxxxxx>