Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-17 Thread Vlastimil Babka
On 9/16/19 5:57 PM, Andrey Ryabinin wrote: >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -710,8 +710,12 @@ static int __init early_debug_pagealloc(char *buf) >> if (kstrtobool(buf, )) >> return -EINVAL; >> >> -if (enable) >> +if (enable) { >>

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-16 Thread Andrey Ryabinin
On 9/16/19 12:42 PM, Vlastimil Babka wrote: > On 9/12/19 7:05 PM, Andrey Ryabinin wrote: >> >> Or another alternative option (and actually easier one to implement), leave >> PAGE_OWNER as is (no "select"s in Kconfigs) >> Make PAGE_OWNER_FREE_STACK like this: >> >> +config PAGE_OWNER_FREE_STACK >>

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-16 Thread Vlastimil Babka
On 9/12/19 7:05 PM, Andrey Ryabinin wrote: > > Or another alternative option (and actually easier one to implement), leave > PAGE_OWNER as is (no "select"s in Kconfigs) > Make PAGE_OWNER_FREE_STACK like this: > > +config PAGE_OWNER_FREE_STACK > + def_bool KASAN || DEBUG_PAGEALLOC > +

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Andrey Ryabinin
On 9/12/19 5:31 PM, 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 >>>

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Walter Wu
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 > >> ---

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Vlastimil Babka
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

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Qian Cai
On Thu, 2019-09-12 at 15:53 +0200, Vlastimil Babka wrote: > On 9/11/19 5:19 PM, Qian Cai wrote: > > > > The new config looks redundant and confusing. It looks to me more of a > > document update > > in Documentation/dev-tools/kasan.txt to educate developers to select > > PAGE_OWNER and > >

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Andrey Ryabinin
On 9/12/19 4:53 PM, Vlastimil Babka wrote: > On 9/11/19 5:19 PM, Qian Cai wrote: >> >> The new config looks redundant and confusing. It looks to me more of a >> document update >> in Documentation/dev-tools/kasan.txt to educate developers to select >> PAGE_OWNER and >> DEBUG_PAGEALLOC if

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Walter Wu
> 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

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-12 Thread Vlastimil Babka
On 9/11/19 5:19 PM, Qian Cai wrote: > > The new config looks redundant and confusing. It looks to me more of a > document update > in Documentation/dev-tools/kasan.txt to educate developers to select > PAGE_OWNER and > DEBUG_PAGEALLOC if needed. Agreed. But if you want it fully automatic, how

Re: [PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-11 Thread Qian Cai
> On Sep 11, 2019, at 4:39 AM, Walter Wu wrote: > > This patch is KASAN's report adds the alloc/free stack for page allocator > in order to help programmer to see memory corruption caused by the page. > > By default, KASAN doesn't record alloc or free stack for page allocator. > It is

[PATCH v3] mm/kasan: dump alloc and free stack for page allocator

2019-09-11 Thread Walter Wu
This patch is KASAN's report adds the alloc/free stack for page allocator in order to help programmer to see memory corruption caused by the page. By default, KASAN doesn't record alloc or free stack for page allocator. It is difficult to fix up the page use-after-free or double-free issue. We