Re: [PATCH RFC v3 09/36] kmsan: add KMSAN bits to struct page and struct task_struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 28, 2019 at 2:44 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Fri, 22 Nov 2019 at 12:26, <glider@xxxxxxxxxx> wrote:
> >
> > Each struct page now contains pointers to two struct pages holding KMSAN
> > metadata (shadow and origins) for the original struct page.
> >
> > Each task_struct contains a struct kmsan_task_state used to track the
> > metadata of function parameters and return values for that task.
> >
> > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
> > Cc: Jens Axboe <axboe@xxxxxxxxx>
> > Cc: Andy Lutomirski <luto@xxxxxxxxxx>
> > Cc: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
> > Cc: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> > Cc: Christoph Hellwig <hch@xxxxxx>
> > Cc: linux-mm@xxxxxxxxx
> > ---
> >
> > Change-Id: Ie329527e558dd60307fb88b2da151f7f4db951ac
> > ---
> >  include/linux/mm_types.h | 9 +++++++++
> >  include/linux/sched.h    | 5 +++++
> >  2 files changed, 14 insertions(+)
> >
> > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> > index 2222fa795284..c87c5416a802 100644
> > --- a/include/linux/mm_types.h
> > +++ b/include/linux/mm_types.h
> > @@ -216,6 +216,15 @@ struct page {
> >                                            not kmapped, ie. highmem) */
> >  #endif /* WANT_PAGE_VIRTUAL */
> >
> > +#ifdef CONFIG_KMSAN
> > +       /*
> > +        * Bits in struct page are scarce, so the LSB in *shadow is used to
> > +        * indicate whether the page should be ignored by KMSAN or not.
> > +        */
> > +       struct page *shadow;
> > +       struct page *origin;
> > +#endif
> > +
> >  #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
> >         int _last_cpupid;
> >  #endif
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index 72b20f33c56e..ba705f66f78c 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -15,6 +15,7 @@
> >  #include <linux/sem.h>
> >  #include <linux/shm.h>
> >  #include <linux/kcov.h>
> > +#include <linux/kmsan.h>
>
> This file does not exist at this point in the series, and the build
> would fail for all configs. This can cause problems for 'git bisect'
> users etc.
I thought we can move this patch past the KMSAN runtime then, but then
the runtime won't be able to use the newly added fields.
> I would just merge this patch with patch 10.
Ack.

> Thanks,
> -- Marco
>
>
> >  #include <linux/mutex.h>
> >  #include <linux/plist.h>
> >  #include <linux/hrtimer.h>
> > @@ -1173,6 +1174,10 @@ struct task_struct {
> >         unsigned int                    kasan_depth;
> >  #endif
> >
> > +#ifdef CONFIG_KMSAN
> > +       struct kmsan_task_state         kmsan;
> > +#endif
> > +
> >  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
> >         /* Index of current stored address in ret_stack: */
> >         int                             curr_ret_stack;
> > --
> > 2.24.0.432.g9d3f5f5b63-goog
> >



-- 
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux