[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANpmjNPk13ib57zFzL1rmWiuhZVvS4bmD-yfoMJOYVWT1FdynQ@mail.gmail.com>
Date: Wed, 3 Aug 2022 22:28:49 +0200
From: Marco Elver <elver@...gle.com>
To: Andrey Konovalov <andreyknvl@...il.com>
Cc: andrey.konovalov@...ux.dev,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Andrey Ryabinin <ryabinin.a.a@...il.com>,
kasan-dev <kasan-dev@...glegroups.com>,
Peter Collingbourne <pcc@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Florian Mayer <fmayer@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrey Konovalov <andreyknvl@...gle.com>
Subject: Re: [PATCH mm v2 30/33] kasan: implement stack ring for tag-based modes
On Tue, 2 Aug 2022 at 22:45, Andrey Konovalov <andreyknvl@...il.com> wrote:
>
> On Thu, Jul 21, 2022 at 10:41 PM Andrey Konovalov <andreyknvl@...il.com> wrote:
> >
> > On Tue, Jul 19, 2022 at 1:41 PM Marco Elver <elver@...gle.com> wrote:
> > >
> > > > + for (u64 i = pos - 1; i != pos - 1 - KASAN_STACK_RING_SIZE; i--) {
> > > > + if (alloc_found && free_found)
> > > > + break;
> > > > +
> > > > + entry = &stack_ring.entries[i % KASAN_STACK_RING_SIZE];
> > > > +
> > > > + /* Paired with smp_store_release() in save_stack_info(). */
> > > > + ptr = (void *)smp_load_acquire(&entry->ptr);
> > > > +
> > > > + if (kasan_reset_tag(ptr) != info->object ||
> > > > + get_tag(ptr) != get_tag(info->access_addr))
> > > > + continue;
> > > > +
> > > > + pid = READ_ONCE(entry->pid);
> > > > + stack = READ_ONCE(entry->stack);
> > > > + is_free = READ_ONCE(entry->is_free);
> > > > +
> > > > + /* Try detecting if the entry was changed while being read. */
> > > > + smp_mb();
> > > > + if (ptr != (void *)READ_ONCE(entry->ptr))
> > > > + continue;
> > >
> > > I thought the re-validation is no longer needed because of the rwlock
> > > protection?
> >
> > Oh, yes, forgot to remove this. Will either do in v3 if there are more
> > things to fix, or will just send a small fix-up patch if the rest of
> > the series looks good.
> >
> > > The rest looks fine now.
> >
> > Thank you, Marco!
>
> Hi Marco,
>
> I'm thinking of sending a v3.
>
> Does your "The rest looks fine now" comment refer only to this patch
> or to the whole series? If it's the former, could you PTAL at the
> other patches?
I just looked again. Apart from the comments I just sent, overall it
looks fine (whole series).
Does test_kasan exercise the ring wrapping around? One thing that
might be worth doing is adding a multi-threaded stress test, where you
have 2+ threads doing lots of allocations, frees, and generating
reports.
Powered by blists - more mailing lists