Re: next: x86_64: kunit test crashed and kernel panic
From: Naresh Kamboju
Date: Fri Feb 17 2023 - 02:30:07 EST
Hi Marco,
On Fri, 17 Feb 2023 at 05:22, Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Thu, 16 Feb 2023 at 19:59, Alexander Potapenko <glider@xxxxxxxxxx> wrote:
> >
> > >
> > > > <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().
> >
> > This was introduced by 69d4c0d321869 ("entry, kasan, x86: Disallow
> > overriding mem*() functions")
>
> Ah, thanks!
>
> > There's Marco's "kasan: Emit different calls for instrumentable
> > memintrinsics", but it doesn't fix the problem for me (looking
> > closer...), and GCC support is still not there, right?
>
> Only Clang 15 supports it at this point. Some future GCC will support it.
>
> > Failing to intercept memcpy/memset/memmove should normally result in
> > false negatives, but kmalloc_memmove_negative_size() makes a strong
> > assumption that KASAN will catch and prevent memmove(dst, src, -2).
>
> Ouch - ok, so we need to skip these tests if we know memintrinsics
> aren't instrumented.
>
> I've sent a series here:
> https://lore.kernel.org/all/20230216234522.3757369-1-elver@xxxxxxxxxx/
Thanks for sending this patch series.
I request you to share your Linux tree / branch / sha.
I will rebuild it with clang-16 and run kunit tests and get back to
you soon with results.
- Naresh