From: Michal Hocko <mhocko@kernel.org>
To: "Bujnak, Stepan" <stepan@pex.com>
Cc: linux-mm@kvack.org, Jonathan Corbet <corbet@lwn.net>,
mcgrof@kernel.org, hannes@cmpxchg.org
Subject: Re: [PATCH] mm/oom: added option 'oom_dump_task_cmdline'
Date: Wed, 20 Feb 2019 11:01:05 +0100 [thread overview]
Message-ID: <20190220100105.GW4525@dhcp22.suse.cz> (raw)
In-Reply-To: <CAFZe2nQW3mUGgSVndzmPirz7BkVUCEyjt=hgxqFn=bntrCsC8A@mail.gmail.com>
On Wed 20-02-19 09:37:56, Bujnak, Stepan wrote:
> On Wed, Feb 20, 2019 at 7:49 AM Michal Hocko <mhocko@kernel.org> wrote:
[...]
> > You are trying to allocate from the OOM context. That is a big no no.
> > Not to mention that this is deadlock prone because get_cmdline needs
> > mmap_sem and the allocating context migh hold the lock already. So the
> > patch is simply wrong.
> >
>
> Thanks for the notes. I understand how allocating from OOM context
> is a problem. However I still believe that this would be helpful
> for debugging OOM kills since task->comm is often not descriptive
> enough. Would it help if instead of calling kstrdup_quotable_cmdline()
> which allocates the buffer on heap I called get_cmdline() directly
> passing it stack-allocated buffer of certain size e.g. 256?
No it wouldn't because get_cmdline take mmap_sem lock as already pointed
out.
Please also note that the cmd line might be considered security/privacy
sensitive information and dumping it to the log sounds like a bad idea
in general.
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2019-02-20 10:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 3:22 Stepan Bujnak
2019-02-20 4:09 ` Randy Dunlap
2019-02-20 4:30 ` Bujnak, Stepan
2019-02-20 5:56 ` Randy Dunlap
2019-02-20 6:49 ` Michal Hocko
2019-02-20 8:37 ` Bujnak, Stepan
2019-02-20 10:00 ` Tetsuo Handa
2019-02-20 10:01 ` Michal Hocko [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=20190220100105.GW4525@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=corbet@lwn.net \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=mcgrof@kernel.org \
--cc=stepan@pex.com \
/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