Re: [PATCH mm] kasan: initialize read-write lock in stack ring

From: Yu Zhao
Date: Tue Sep 20 2022 - 15:14:26 EST


On Tue, Sep 20, 2022 at 1:10 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Tue, 20 Sept 2022 at 20:58, <andrey.konovalov@xxxxxxxxx> wrote:
> >
> > From: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
> >
> > Use __RW_LOCK_UNLOCKED to initialize stack_ring.lock.
> >
> > Reported-by: Yu Zhao <yuzhao@xxxxxxxxxx>
> > Signed-off-by: Andrey Konovalov <andreyknvl@xxxxxxxxxx>
> >
> > ---
> >
> > Andrew, could you please fold this patch into:
> > "kasan: implement stack ring for tag-based modes".
> > ---
> > mm/kasan/tags.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
> > index 9d867cae1b7b..67a222586846 100644
> > --- a/mm/kasan/tags.c
> > +++ b/mm/kasan/tags.c
> > @@ -36,7 +36,9 @@ DEFINE_STATIC_KEY_TRUE(kasan_flag_stacktrace);
> > /* Non-zero, as initial pointer values are 0. */
> > #define STACK_RING_BUSY_PTR ((void *)1)
> >
> > -struct kasan_stack_ring stack_ring;
> > +struct kasan_stack_ring stack_ring = {
> > + .lock = __RW_LOCK_UNLOCKED(stack_ring.lock)
> > +};
>
> Reviewed-by: Marco Elver <elver@xxxxxxxxxx>

Tested-by: Yu Zhao <yuzhao@xxxxxxxxxx>