Re: [PATCH RFC v3 23/36] kmsan: call KMSAN hooks where needed

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

 



On Tue, Nov 26, 2019 at 11:17 AM Petr Mladek <pmladek@xxxxxxxx> wrote:
>
> On Fri 2019-11-22 12:26:08, glider@xxxxxxxxxx wrote:
> > Insert KMSAN hooks that check for potential memory errors and/or make
> > necessary bookkeeping changes:
> >  - allocate/split/deallocate metadata pages in
> >    alloc_pages()/split_page()/free_page();
> >  - clear page shadow and origins in clear_page(), copy_user_highpage();
> >  - copy page metadata in copy_highpage(), wp_page_copy();
> >  - handle vmap()/vunmap()/iounmap();
> >  - handle task creation and deletion;
> >  - initialize result of vscnprintf() in vprintk_store();
> >  - call softirq entry/exit hooks in kernel/softirq.c;
> >  - check/initialize memory sent to/read from USB, I2C, and network
I forgot to remove I2C from patch description, will do in the next patch series.
> >
> > Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
>
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index ca65327a6de8..c9ef7fb0906f 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -1915,6 +1915,12 @@ int vprintk_store(int facility, int level,
> >        * prefix which might be passed-in as a parameter.
> >        */
> >       text_len = vscnprintf(text, sizeof(textbuf), fmt, args);
> > +     /*
> > +      * If any of vscnprintf() arguments is uninitialized, KMSAN will report
> > +      * one or more errors and also probably mark text_len as uninitialized.
> > +      * Initialize |text_len| to prevent the errors from spreading further.
> > +      */
> > +     text_len = KMSAN_INIT_VALUE(text_len);
> >
> >       /* mark and strip a trailing newline */
> >       if (text_len && text[text_len-1] == '\n') {
>
> Acked-by: Petr Mladek <pmladek@xxxxxxxx>        # for printk.c
>
> Best Regards,
> Petr



-- 
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