Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1504858

Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv
Date 2016-10-20 14:50 +0200
Message-ID <sukXf-7Cr-3@gated-at.bofh.it> (permalink)
References <su02u-2rf-51@gated-at.bofh.it> <su2GZ-4ip-15@gated-at.bofh.it> <sukNA-7z7-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu <chianglungyu@gmail.com> - 2016-10-19 18:30 +0200
  Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Michal Hocko <mhocko@kernel.org> - 2016-10-19 19:20 +0200
    Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu <chianglungyu@gmail.com> - 2016-10-20 14:40 +0200
      Re: [PATCH] proc: fix NULL dereference when reading /proc/<pid>/auxv Michal Hocko <mhocko@kernel.org> - 2016-10-20 14:50 +0200
  [PATCH v2] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu <chianglungyu@gmail.com> - 2016-10-20 14:30 +0200
    Re: [PATCH v2] proc: fix NULL dereference when reading         /proc/<pid>/auxv Oleg Nesterov <oleg@redhat.com> - 2016-10-20 19:10 +0200
      Re: [PATCH v2] proc: fix NULL dereference when reading  /proc/<pid>/auxv Michal Hocko <mhocko@kernel.org> - 2016-10-20 21:30 +0200
        Re: [PATCH v2] proc: fix NULL dereference when reading /proc/<pid>/auxv Leon Yu <chianglungyu@gmail.com> - 2016-10-21 14:50 +0200

csiph-web