Message ID | 20191122112621.204798-12-glider@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add KernelMemorySanitizer infrastructure | expand |
On Fri, Nov 22, 2019 at 12:27 PM <glider@google.com> wrote: > > We assume nothing interesting could happen in stackdepot, and save some > memory by not tracking stackdepot allocations with KMSAN. I think it makes sense to clarify here that "nothing interesting" means no uninitialized memory can come from stackdepot or something like that. > > Signed-off-by: Alexander Potapenko <glider@google.com> > Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> > Cc: Jens Axboe <axboe@kernel.dk> > Cc: Andy Lutomirski <luto@kernel.org> > Cc: Vegard Nossum <vegard.nossum@oracle.com> > Cc: Dmitry Vyukov <dvyukov@google.com> > Cc: Christoph Hellwig <hch@lst.de> > Cc: linux-mm@kvack.org > --- > > Change-Id: Ic3ec9b3dff3fff2732d874508a3582fb26ff0b1f > --- > lib/stackdepot.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/lib/stackdepot.c b/lib/stackdepot.c > index e2f000a9fad8..2b053c429454 100644 > --- a/lib/stackdepot.c > +++ b/lib/stackdepot.c > @@ -294,7 +294,8 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries, > * contexts and I/O. > */ > alloc_flags &= ~GFP_ZONEMASK; > - alloc_flags &= (GFP_ATOMIC | GFP_KERNEL); > + alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | > + __GFP_NO_KMSAN_SHADOW); > alloc_flags |= __GFP_NOWARN; > page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER); > if (page) > -- > 2.24.0.432.g9d3f5f5b63-goog >
On Fri, Nov 29, 2019 at 3:52 PM Andrey Konovalov <andreyknvl@google.com> wrote: > > On Fri, Nov 22, 2019 at 12:27 PM <glider@google.com> wrote: > > > > We assume nothing interesting could happen in stackdepot, and save some > > memory by not tracking stackdepot allocations with KMSAN. > > I think it makes sense to clarify here that "nothing interesting" > means no uninitialized memory can come from stackdepot or something > like that. Agreed. Will update the patch description. I've also noticed this patch does nothing to ensure the allocations are performed with __GFP_NO_KMSAN_SHADOW. > > > > Signed-off-by: Alexander Potapenko <glider@google.com> > > Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> > > Cc: Jens Axboe <axboe@kernel.dk> > > Cc: Andy Lutomirski <luto@kernel.org> > > Cc: Vegard Nossum <vegard.nossum@oracle.com> > > Cc: Dmitry Vyukov <dvyukov@google.com> > > Cc: Christoph Hellwig <hch@lst.de> > > Cc: linux-mm@kvack.org > > --- > > > > Change-Id: Ic3ec9b3dff3fff2732d874508a3582fb26ff0b1f > > --- > > lib/stackdepot.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/lib/stackdepot.c b/lib/stackdepot.c > > index e2f000a9fad8..2b053c429454 100644 > > --- a/lib/stackdepot.c > > +++ b/lib/stackdepot.c > > @@ -294,7 +294,8 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries, > > * contexts and I/O. > > */ > > alloc_flags &= ~GFP_ZONEMASK; > > - alloc_flags &= (GFP_ATOMIC | GFP_KERNEL); > > + alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | > > + __GFP_NO_KMSAN_SHADOW); > > alloc_flags |= __GFP_NOWARN; Should have added __GFP_NO_KMSAN_SHADOW here. > > page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER); > > if (page) > > -- > > 2.24.0.432.g9d3f5f5b63-goog > >
diff --git a/lib/stackdepot.c b/lib/stackdepot.c index e2f000a9fad8..2b053c429454 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -294,7 +294,8 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries, * contexts and I/O. */ alloc_flags &= ~GFP_ZONEMASK; - alloc_flags &= (GFP_ATOMIC | GFP_KERNEL); + alloc_flags &= (GFP_ATOMIC | GFP_KERNEL | + __GFP_NO_KMSAN_SHADOW); alloc_flags |= __GFP_NOWARN; page = alloc_pages(alloc_flags, STACK_ALLOC_ORDER); if (page)
We assume nothing interesting could happen in stackdepot, and save some memory by not tracking stackdepot allocations with KMSAN. Signed-off-by: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Andy Lutomirski <luto@kernel.org> Cc: Vegard Nossum <vegard.nossum@oracle.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Christoph Hellwig <hch@lst.de> Cc: linux-mm@kvack.org --- Change-Id: Ic3ec9b3dff3fff2732d874508a3582fb26ff0b1f --- lib/stackdepot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)