[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1568301233.19274.17.camel@mtksdccf07>
Date: Thu, 12 Sep 2019 23:13:53 +0800
From: Walter Wu <walter-zh.wu@...iatek.com>
To: Vlastimil Babka <vbabka@...e.cz>
CC: Qian Cai <cai@....pw>, Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Matthias Brugger <matthias.bgg@...il.com>,
"Andrew Morton" <akpm@...ux-foundation.org>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
"Arnd Bergmann" <arnd@...db.de>, <linux-kernel@...r.kernel.org>,
<kasan-dev@...glegroups.com>, <linux-mm@...ck.org>,
<linux-arm-kernel@...ts.infradead.org>,
<linux-mediatek@...ts.infradead.org>, <wsd_upstream@...iatek.com>
Subject: Re: [PATCH v3] mm/kasan: dump alloc and free stack for page
allocator
On Thu, 2019-09-12 at 16:31 +0200, Vlastimil Babka wrote:
> On 9/12/19 4:08 PM, Walter Wu wrote:
> >
> >> extern void __reset_page_owner(struct page *page, unsigned int order);
> >> diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
> >> index 6c9682ce0254..dc560c7562e8 100644
> >> --- a/lib/Kconfig.kasan
> >> +++ b/lib/Kconfig.kasan
> >> @@ -41,6 +41,8 @@ config KASAN_GENERIC
> >> select SLUB_DEBUG if SLUB
> >> select CONSTRUCTORS
> >> select STACKDEPOT
> >> + select PAGE_OWNER
> >> + select PAGE_OWNER_FREE_STACK
> >> help
> >> Enables generic KASAN mode.
> >> Supported in both GCC and Clang. With GCC it requires version 4.9.2
> >> @@ -63,6 +65,8 @@ config KASAN_SW_TAGS
> >> select SLUB_DEBUG if SLUB
> >> select CONSTRUCTORS
> >> select STACKDEPOT
> >> + select PAGE_OWNER
> >> + select PAGE_OWNER_FREE_STACK
> >> help
> >
> > What is the difference between PAGE_OWNER+PAGE_OWNER_FREE_STACK and
> > DEBUG_PAGEALLOC?
>
> Same memory usage, but debug_pagealloc means also extra checks and
> restricting memory access to freed pages to catch UAF.
>
> > If you directly enable PAGE_OWNER+PAGE_OWNER_FREE_STACK
> > PAGE_OWNER_FREE_STACK,don't you think low-memory device to want to use
> > KASAN?
>
> OK, so it should be optional? But I think it's enough to distinguish no
> PAGE_OWNER at all, and PAGE_OWNER+PAGE_OWNER_FREE_STACK together - I
> don't see much point in PAGE_OWNER only for this kind of debugging.
>
If it's possible, it should be optional.
My experience is that PAGE_OWNER usually debug memory leakage.
> So how about this? KASAN wouldn't select PAGE_OWNER* but it would be
> recommended in the help+docs. When PAGE_OWNER and KASAN are selected by
> user, PAGE_OWNER_FREE_STACK gets also selected, and both will be also
> runtime enabled without explicit page_owner=on.
> I mostly want to avoid another boot-time option for enabling
> PAGE_OWNER_FREE_STACK.
> Would that be enough flexibility for low-memory devices vs full-fledged
> debugging?
We usually see feature option to decide whether it meet the platform.
The boot-time option isn't troubled to us, because enable the feature
owner should know what he should add to do.
Powered by blists - more mailing lists