Re: [PATCH] kmemleak: fix check for softirq context

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

 



On Sat, May 18, 2019 at 09:10:59AM +0200, Dmitry Vyukov wrote:
> On Fri, May 17, 2019 at 11:37 PM Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> > On Fri, 17 May 2019 19:15:07 +0200 Dmitry Vyukov <dvyukov@xxxxxxxxx> wrote:
> >
> > > From: Dmitry Vyukov <dvyukov@xxxxxxxxxx>
> > >
> > > in_softirq() is a wrong predicate to check if we are in a softirq context.
> > > It also returns true if we have BH disabled, so objects are falsely
> > > stamped with "softirq" comm. The correct predicate is in_serving_softirq().
> > >
> > > ...
> > >
> > > --- a/mm/kmemleak.c
> > > +++ b/mm/kmemleak.c
> > > @@ -588,7 +588,7 @@ static struct kmemleak_object *create_object(unsigned long ptr, size_t size,
> > >       if (in_irq()) {
> > >               object->pid = 0;
> > >               strncpy(object->comm, "hardirq", sizeof(object->comm));
> > > -     } else if (in_softirq()) {
> > > +     } else if (in_serving_softirq()) {
> > >               object->pid = 0;
> > >               strncpy(object->comm, "softirq", sizeof(object->comm));
> > >       } else {
> >
> > What are the user-visible runtime effects of this change?
> 
> If user does cat from /sys/kernel/debug/kmemleak previously they would
> see this, which is clearly wrong, this is system call context (see the
> comm):

Indeed, with your patch you get the correct output.

Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx>

Thanks.

-- 
Catalin




[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