Re: next: x86_64: kunit test crashed and kernel panic

From: Alexander Potapenko
Date: Thu Feb 16 2023 - 11:35:20 EST


On Thu, Feb 16, 2023 at 1:13 PM Naresh Kamboju
<naresh.kamboju@xxxxxxxxxx> wrote:
>
> Following kernel panic noticed while running KUNIT testing on qemu-x86_64
> with KASAN enabled kernel.
>
> CONFIG_KASAN=y
> CONFIG_KUNIT=y
> CONFIG_KUNIT_ALL_TESTS=y
>

This is reproducible for me locally, taking a look...


> <4>[ 38.796558] ? kmalloc_memmove_negative_size+0xeb/0x1f0
> <4>[ 38.797376] ? __pfx_kmalloc_memmove_negative_size+0x10/0x10

Most certainly kmalloc_memmove_negative_size() is related.
Looks like we fail to intercept the call to memmove() in this test,
passing -2 to the actual __memmove().