linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
@ 2019-09-09  8:53 Walter Wu
  2019-09-09 10:57 ` David Hildenbrand
  2019-09-09 12:59 ` Vlastimil Babka
  0 siblings, 2 replies; 6+ messages in thread
From: Walter Wu @ 2019-09-09  8:53 UTC (permalink / raw)
  To: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
	Matthias Brugger, Andrew Morton, Martin Schwidefsky, Will Deacon,
	Andrey Konovalov, Arnd Bergmann, Thomas Gleixner, Michal Hocko,
	Qian Cai
  Cc: linux-kernel, kasan-dev, linux-mm, linux-arm-kernel,
	linux-mediatek, wsd_upstream, Walter Wu

KASAN will record last stack of page in order to help programmer
to see memory corruption caused by page.

What is difference between page_owner and our patch?
page_owner records alloc stack of page, but our patch is to record
last stack(it may be alloc or free stack of page).

Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
---
 mm/page_ext.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/page_ext.c b/mm/page_ext.c
index 5f5769c7db3b..7ca33dcd9ffa 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
 #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
 	&page_idle_ops,
 #endif
+#ifdef CONFIG_KASAN
+	&page_stack_ops,
+#endif
 };
 
 static unsigned long total_usage;
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
  2019-09-09  8:53 [PATCH v2 1/2] mm/page_ext: support to record the last stack of page Walter Wu
@ 2019-09-09 10:57 ` David Hildenbrand
  2019-09-10  1:07   ` Walter Wu
  2019-09-09 12:59 ` Vlastimil Babka
  1 sibling, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2019-09-09 10:57 UTC (permalink / raw)
  To: Walter Wu, Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
	Matthias Brugger, Andrew Morton, Martin Schwidefsky, Will Deacon,
	Andrey Konovalov, Arnd Bergmann, Thomas Gleixner, Michal Hocko,
	Qian Cai
  Cc: linux-kernel, kasan-dev, linux-mm, linux-arm-kernel,
	linux-mediatek, wsd_upstream

On 09.09.19 10:53, Walter Wu wrote:
> KASAN will record last stack of page in order to help programmer
> to see memory corruption caused by page.
> 
> What is difference between page_owner and our patch?
> page_owner records alloc stack of page, but our patch is to record
> last stack(it may be alloc or free stack of page).
> 
> Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
> ---
>  mm/page_ext.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 5f5769c7db3b..7ca33dcd9ffa 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
>  #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
>  	&page_idle_ops,
>  #endif
> +#ifdef CONFIG_KASAN
> +	&page_stack_ops,
> +#endif
>  };
>  
>  static unsigned long total_usage;
> 

Are you sure this patch compiles?

t460s: ~/git/linux virtio-mem $ git grep page_stack_ops
t460s: ~/git/linux virtio-mem $

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
  2019-09-09  8:53 [PATCH v2 1/2] mm/page_ext: support to record the last stack of page Walter Wu
  2019-09-09 10:57 ` David Hildenbrand
@ 2019-09-09 12:59 ` Vlastimil Babka
  1 sibling, 0 replies; 6+ messages in thread
From: Vlastimil Babka @ 2019-09-09 12:59 UTC (permalink / raw)
  To: Walter Wu, Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
	Matthias Brugger, Andrew Morton, Martin Schwidefsky, Will Deacon,
	Andrey Konovalov, Arnd Bergmann, Thomas Gleixner, Michal Hocko,
	Qian Cai
  Cc: linux-kernel, kasan-dev, linux-mm, linux-arm-kernel,
	linux-mediatek, wsd_upstream

On 9/9/19 10:53 AM, Walter Wu wrote:
> KASAN will record last stack of page in order to help programmer
> to see memory corruption caused by page.
> 
> What is difference between page_owner and our patch?
> page_owner records alloc stack of page, but our patch is to record
> last stack(it may be alloc or free stack of page).
> 
> Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>

There's no point in separating this from patch 2 (and as David pointed 
out, doesn't compile).

> ---
>   mm/page_ext.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 5f5769c7db3b..7ca33dcd9ffa 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
>   #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
>   	&page_idle_ops,
>   #endif
> +#ifdef CONFIG_KASAN
> +	&page_stack_ops,
> +#endif
>   };
>   
>   static unsigned long total_usage;
> 


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
  2019-09-09 10:57 ` David Hildenbrand
@ 2019-09-10  1:07   ` Walter Wu
  2019-09-10  9:31     ` Kirill A. Shutemov
  0 siblings, 1 reply; 6+ messages in thread
From: Walter Wu @ 2019-09-10  1:07 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Andrey Ryabinin, Alexander Potapenko, Dmitry Vyukov,
	Matthias Brugger, Andrew Morton, Martin Schwidefsky, Will Deacon,
	Andrey Konovalov, Arnd Bergmann, Thomas Gleixner, Michal Hocko,
	Qian Cai, linux-kernel, kasan-dev, linux-mm, linux-arm-kernel,
	linux-mediatek, wsd_upstream

On Mon, 2019-09-09 at 12:57 +0200, David Hildenbrand wrote:
> On 09.09.19 10:53, Walter Wu wrote:
> > KASAN will record last stack of page in order to help programmer
> > to see memory corruption caused by page.
> > 
> > What is difference between page_owner and our patch?
> > page_owner records alloc stack of page, but our patch is to record
> > last stack(it may be alloc or free stack of page).
> > 
> > Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
> > ---
> >  mm/page_ext.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/mm/page_ext.c b/mm/page_ext.c
> > index 5f5769c7db3b..7ca33dcd9ffa 100644
> > --- a/mm/page_ext.c
> > +++ b/mm/page_ext.c
> > @@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
> >  #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
> >  	&page_idle_ops,
> >  #endif
> > +#ifdef CONFIG_KASAN
> > +	&page_stack_ops,
> > +#endif
> >  };
> >  
> >  static unsigned long total_usage;
> > 
> 
> Are you sure this patch compiles?
> 
This is patchsets, it need another patch2.
We have verified it by running KASAN UT on Qemu.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
  2019-09-10  1:07   ` Walter Wu
@ 2019-09-10  9:31     ` Kirill A. Shutemov
  2019-09-10  9:43       ` Walter Wu
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill A. Shutemov @ 2019-09-10  9:31 UTC (permalink / raw)
  To: Walter Wu
  Cc: David Hildenbrand, Andrey Ryabinin, Alexander Potapenko,
	Dmitry Vyukov, Matthias Brugger, Andrew Morton,
	Martin Schwidefsky, Will Deacon, Andrey Konovalov, Arnd Bergmann,
	Thomas Gleixner, Michal Hocko, Qian Cai, linux-kernel, kasan-dev,
	linux-mm, linux-arm-kernel, linux-mediatek, wsd_upstream

On Tue, Sep 10, 2019 at 09:07:49AM +0800, Walter Wu wrote:
> On Mon, 2019-09-09 at 12:57 +0200, David Hildenbrand wrote:
> > On 09.09.19 10:53, Walter Wu wrote:
> > > KASAN will record last stack of page in order to help programmer
> > > to see memory corruption caused by page.
> > > 
> > > What is difference between page_owner and our patch?
> > > page_owner records alloc stack of page, but our patch is to record
> > > last stack(it may be alloc or free stack of page).
> > > 
> > > Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
> > > ---
> > >  mm/page_ext.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/mm/page_ext.c b/mm/page_ext.c
> > > index 5f5769c7db3b..7ca33dcd9ffa 100644
> > > --- a/mm/page_ext.c
> > > +++ b/mm/page_ext.c
> > > @@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
> > >  #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
> > >  	&page_idle_ops,
> > >  #endif
> > > +#ifdef CONFIG_KASAN
> > > +	&page_stack_ops,
> > > +#endif
> > >  };
> > >  
> > >  static unsigned long total_usage;
> > > 
> > 
> > Are you sure this patch compiles?
> > 
> This is patchsets, it need another patch2.
> We have verified it by running KASAN UT on Qemu.

Any patchset must be bisectable: do not break anything in the middle of
patchset.

-- 
 Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] mm/page_ext: support to record the last stack of page
  2019-09-10  9:31     ` Kirill A. Shutemov
@ 2019-09-10  9:43       ` Walter Wu
  0 siblings, 0 replies; 6+ messages in thread
From: Walter Wu @ 2019-09-10  9:43 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: David Hildenbrand, Andrey Ryabinin, Alexander Potapenko,
	Dmitry Vyukov, Matthias Brugger, Andrew Morton,
	Martin Schwidefsky, Will Deacon, Andrey Konovalov, Arnd Bergmann,
	Thomas Gleixner, Michal Hocko, Qian Cai, linux-kernel, kasan-dev,
	linux-mm, linux-arm-kernel, linux-mediatek, wsd_upstream

On Tue, 2019-09-10 at 12:31 +0300, Kirill A. Shutemov wrote:
> On Tue, Sep 10, 2019 at 09:07:49AM +0800, Walter Wu wrote:
> > On Mon, 2019-09-09 at 12:57 +0200, David Hildenbrand wrote:
> > > On 09.09.19 10:53, Walter Wu wrote:
> > > > KASAN will record last stack of page in order to help programmer
> > > > to see memory corruption caused by page.
> > > > 
> > > > What is difference between page_owner and our patch?
> > > > page_owner records alloc stack of page, but our patch is to record
> > > > last stack(it may be alloc or free stack of page).
> > > > 
> > > > Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
> > > > ---
> > > >  mm/page_ext.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/mm/page_ext.c b/mm/page_ext.c
> > > > index 5f5769c7db3b..7ca33dcd9ffa 100644
> > > > --- a/mm/page_ext.c
> > > > +++ b/mm/page_ext.c
> > > > @@ -65,6 +65,9 @@ static struct page_ext_operations *page_ext_ops[] = {
> > > >  #if defined(CONFIG_IDLE_PAGE_TRACKING) && !defined(CONFIG_64BIT)
> > > >  	&page_idle_ops,
> > > >  #endif
> > > > +#ifdef CONFIG_KASAN
> > > > +	&page_stack_ops,
> > > > +#endif
> > > >  };
> > > >  
> > > >  static unsigned long total_usage;
> > > > 
> > > 
> > > Are you sure this patch compiles?
> > > 
> > This is patchsets, it need another patch2.
> > We have verified it by running KASAN UT on Qemu.
> 
> Any patchset must be bisectable: do not break anything in the middle of
> patchset.
> 

Thanks your reminder.
I should explain complete message at commit log.
Our patchsets is below:
https://lkml.org/lkml/2019/9/9/104
https://lkml.org/lkml/2019/9/9/123



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-09-10  9:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09  8:53 [PATCH v2 1/2] mm/page_ext: support to record the last stack of page Walter Wu
2019-09-09 10:57 ` David Hildenbrand
2019-09-10  1:07   ` Walter Wu
2019-09-10  9:31     ` Kirill A. Shutemov
2019-09-10  9:43       ` Walter Wu
2019-09-09 12:59 ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).