[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1567568466.9011.34.camel@mtksdccf07>
Date: Wed, 4 Sep 2019 11:41:06 +0800
From: Walter Wu <walter-zh.wu@...iatek.com>
To: Andrey Konovalov <andreyknvl@...gle.com>
CC: Andrey Ryabinin <aryabinin@...tuozzo.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
"Alexander Potapenko" <glider@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5] kasan: add memory corruption identification for
software tag-based mode
> > const char *get_bug_type(struct kasan_access_info *info)
> > {
> > +#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY
> > + struct kasan_alloc_meta *alloc_meta;
> > + struct kmem_cache *cache;
> > + struct page *page;
> > + const void *addr;
> > + void *object;
> > + u8 tag;
> > + int i;
> > +
> > + tag = get_tag(info->access_addr);
> > + addr = reset_tag(info->access_addr);
> > + page = kasan_addr_to_page(addr);
> > + if (page && PageSlab(page)) {
> > + cache = page->slab_cache;
> > + object = nearest_obj(cache, page, (void *)addr);
> > + alloc_meta = get_alloc_info(cache, object);
> > +
> > + for (i = 0; i < KASAN_NR_FREE_STACKS; i++)
> > + if (alloc_meta->free_pointer_tag[i] == tag)
> > + return "use-after-free";
> > + return "out-of-bounds";
>
> I think we should keep the "invalid-access" bug type here if we failed
> to identify the bug as a "use-after-free" (and change the patch
> description accordingly).
>
> Other than that:
>
> Acked-by: Andrey Konovalov <andreyknvl@...gle.com>
>
Thanks your suggestion.
If slab records is not found, it may be use-after-free or out-of-bounds.
Maybe We can think how to avoid the situation(check object range or
other?), if possible, I will send patch or adopt your suggestion
modification.
regards,
Walter
Powered by blists - more mailing lists