From: Catalin Marinas <catalin.marinas@arm.com>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Dmitry Vyukov <dvyukov@gmail.com>, Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kmemleak: fix check for softirq context
Date: Sat, 18 May 2019 10:47:20 +0100 [thread overview]
Message-ID: <20190518094719.gyvhbdrwmcv4diax@mbp> (raw)
In-Reply-To: <CACT4Y+aee_Kvezo8zeD77RwBi2-Csd9cE8vtGCmaTGYxr=iK5A@mail.gmail.com>
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@linux-foundation.org> wrote:
> > On Fri, 17 May 2019 19:15:07 +0200 Dmitry Vyukov <dvyukov@gmail.com> wrote:
> >
> > > From: Dmitry Vyukov <dvyukov@google.com>
> > >
> > > 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@arm.com>
Thanks.
--
Catalin
prev parent reply other threads:[~2019-05-18 9:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 17:15 Dmitry Vyukov
2019-05-17 21:37 ` Andrew Morton
2019-05-18 7:10 ` Dmitry Vyukov
2019-05-18 9:47 ` Catalin Marinas [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190518094719.gyvhbdrwmcv4diax@mbp \
--to=catalin.marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@gmail.com \
--cc=dvyukov@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox