Re: [PATCH v2 12/19] lib/stackdepot: use list_head for stack record links

From: Andrey Konovalov
Date: Mon Oct 23 2023 - 12:18:34 EST


On Mon, Oct 9, 2023 at 2:16 PM Alexander Potapenko <glider@xxxxxxxxxx> wrote:
>
> On Sat, Sep 16, 2023 at 10:04 PM Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > On Sat, 16 Sep 2023 19:43:35 +0200 Anders Roxell <anders.roxell@xxxxxxxxxx> wrote:
> >
> > > On 2023-09-13 19:14, andrey.konovalov@xxxxxxxxx wrote:
> > > > From: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
> > > >
> > > > Switch stack_record to use list_head for links in the hash table
> > > > and in the freelist.
> > > >
> > > > This will allow removing entries from the hash table buckets.
> > > >
> > > > This is preparatory patch for implementing the eviction of stack records
> > > > from the stack depot.
> > > >
> > > > Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
> > > >
> > >
> > > Building on an arm64 kernel from linux-next tag next-20230915, and boot
> > > that in QEMU. I see the following kernel panic.
> > >
> > > ...
> > >
> > > The full log can be found [1] and the .config file [2]. I bisected down
> > > to this commit, see the bisect log [3].
>
> I am also seeing similar crashes on an x86 KMSAN build.
>
> They are happening when in the following code:
>
> list_for_each(pos, bucket) {
> found = list_entry(pos, struct stack_record, list);
> if (found->hash == hash &&
> found->size == size &&
> !stackdepot_memcmp(entries, found->entries, size))
> return found;
> }
>
> `found` is NULL
>
> @Andrey, could you please take a look?

Found a bug, will fix in v3. Thank you!