Re: [PATCH RFC v3 03/36] kasan: stackdepot: move filter_irq_stacks() to stackdepot.c

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

 



On Wed, Nov 27, 2019 at 3:23 PM Marco Elver <elver@xxxxxxxxxx> wrote:
>
> On Fri, 22 Nov 2019 at 12:26, <glider@xxxxxxxxxx> wrote:
> [...]
> > diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
> > index 3efa97d482cb..24d49c732341 100644
> > --- a/include/linux/stackdepot.h
> > +++ b/include/linux/stackdepot.h
> > @@ -19,4 +19,6 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries,
> >  unsigned int stack_depot_fetch(depot_stack_handle_t handle,
> >                                unsigned long **entries);
> >
> > +unsigned int filter_irq_stacks(unsigned long *entries, unsigned int nr_entries);
> > +
> >  #endif
> > diff --git a/lib/stackdepot.c b/lib/stackdepot.c
> > index 6d1123123e56..eb95197b8743 100644
> > --- a/lib/stackdepot.c
> > +++ b/lib/stackdepot.c
> > @@ -20,6 +20,7 @@
> >   */
> >
> >  #include <linux/gfp.h>
> > +#include <linux/interrupt.h>
> >  #include <linux/jhash.h>
> >  #include <linux/kernel.h>
> >  #include <linux/mm.h>
> > @@ -314,3 +315,25 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries,
> >         return retval;
> >  }
> >  EXPORT_SYMBOL_GPL(stack_depot_save);
> > +
> > +static inline int in_irqentry_text(unsigned long ptr)
> > +{
> > +       return (ptr >= (unsigned long)&__irqentry_text_start &&
> > +               ptr < (unsigned long)&__irqentry_text_end) ||
> > +               (ptr >= (unsigned long)&__softirqentry_text_start &&
> > +                ptr < (unsigned long)&__softirqentry_text_end);
> > +}
> > +
> > +unsigned int filter_irq_stacks(unsigned long *entries,
> > +                                            unsigned int nr_entries)
> > +{
> > +       unsigned int i;
> > +
> > +       for (i = 0; i < nr_entries; i++) {
> > +               if (in_irqentry_text(entries[i])) {
> > +                       /* Include the irqentry function into the stack. */
> > +                       return i + 1;
> > +               }
> > +       }
> > +       return nr_entries;
> > +}
>
> Does this need an EXPORT_SYMBOL_GPL ?
Yes, makes sense.



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