public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Leon Yu <chianglungyu@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Kees Cook <keescook@chromium.org>,
	Oleg Nesterov <oleg@redhat.com>,
	John Stultz <john.stultz@linaro.org>,
	Mateusz Guzik <mguzik@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Janis Danisevskis <jdanis@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv
Date: Thu, 20 Oct 2016 14:44:06 +0200	[thread overview]
Message-ID: <20161020124405.GL14609@dhcp22.suse.cz> (raw)
In-Reply-To: <CAP06WZy2wdcKx70xTihw4U3Z7Vo=9CHSmzL4b-rWVcCxa0M=VQ@mail.gmail.com>

On Thu 20-10-16 20:32:43, Leon Yu wrote:
> On Thu, Oct 20, 2016 at 1:17 AM, Michal Hocko <mhocko@kernel.org> wrote:
> > So here is my RFC as an alternative. Thoughts? Please note that we
> > currently have only very few users of use_mm() API in the kernel
> > so a risk of a regression is not really high. usb/gadget are using it
> > only temporarily. The remaining is vhost which operates on a remote mm
> > and I have no idea whether somebody might abuse /proc/vhost/mem or
> > anything - let's add Michael to the CC list. I am pretty sure nobody
> > abuse oom_reaper proc directory as this one is pretty new and such a
> > usage would be pretty much undefined as the reaper unmaps the address
> > space.
> 
> With this patch I cannot tell the difference between a) the thread is
> exiting and b) it's a kernel thread,
> besides, getting "no such process" while the kthread does exist is a
> bit confusing.

Do we really need to distinguish those two cases? In other words under
which conditions something would fail when seeing a pid directory and
ESRCH when opening a file?

> IMO, reading /proc/<kthread_pid>/auxv and getting empty output are
> quite straightforward,
> it doesn't seem to be that "abusive".

Then we need to teach all those implementations to check for kthread
explicitly and return an empty output rather than relying on mm == NULL
because that, as explained, might belong to some process.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2016-10-20 12:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 13:59 [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu
2016-10-19 14:13 ` Michal Hocko
2016-10-19 16:12   ` Oleg Nesterov
2016-10-19 16:17     ` Michal Hocko
2016-10-19 16:44       ` Oleg Nesterov
2016-10-19 17:00         ` Michal Hocko
2016-10-19 14:20 ` Al Viro
2016-10-19 14:51   ` Michal Hocko
2016-10-19 14:51   ` Leon Yu
2016-10-19 17:17 ` Michal Hocko
2016-10-20 12:32   ` Leon Yu
2016-10-20 12:44     ` Michal Hocko [this message]
2016-10-20 12:23 ` [PATCH v2] " Leon Yu
2016-10-20 17:04   ` Oleg Nesterov
2016-10-20 19:21     ` Michal Hocko
2016-10-21 12:47       ` Leon Yu

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=20161020124405.GL14609@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chianglungyu@gmail.com \
    --cc=jdanis@google.com \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mguzik@redhat.com \
    --cc=mst@redhat.com \
    --cc=oleg@redhat.com \
    --cc=viro@zeniv.linux.org.uk \
    /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