From: Michal Hocko <mhocko@kernel.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
chianglungyu@gmail.com, Janis Danisevskis <jdanis@google.com>,
John Stultz <john.stultz@linaro.org>,
Kees Cook <keescook@chromium.org>,
Mateusz Guzik <mguzik@redhat.com>,
Oleg Nesterov <oleg@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
mm-commits@vger.kernel.org
Subject: Re: + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch added to -mm tree
Date: Fri, 21 Oct 2016 16:14:54 +0200 [thread overview]
Message-ID: <20161021141453.GN6045@dhcp22.suse.cz> (raw)
In-Reply-To: <CACVxJT_ajJu+iEcxG-PO=diPrY2ADTrs+KOESE3-m8+xvqDEMA@mail.gmail.com>
On Fri 21-10-16 16:44:03, Alexey Dobriyan wrote:
> On Fri, Oct 21, 2016 at 6:13 AM, <akpm@linux-foundation.org> wrote:
>
> > Reading auxv of any kernel thread results in NULL pointer dereferencing in
> > auxv_read() where mm can be NULL. Fix that by checking for NULL mm and
> > bailing out early. This is also the original behavior changed by recent
> > commit c5317167854e ("proc: switch auxv to use of __mem_open()").
>
> > --- a/fs/proc/base.c~proc-fix-null-dereference-when-reading-proc-pid-auxv
> > +++ a/fs/proc/base.c
> > @@ -1014,6 +1014,9 @@ static ssize_t auxv_read(struct file *fi
> > {
> > struct mm_struct *mm = file->private_data;
> > unsigned int nwords = 0;
> > +
> > + if (!mm)
> > + return 0;
>
> Rhetorical question: who wrote such clever __mem_open() ?
This is nothing really new. __mem_open resp. proc_mem_open returned NULL
mm for ages. I was suggesting to return ESRCH for NULL mm [1].
[1] http://lkml.kernel.org/r/20161019171748.GO24393@dhcp22.suse.cz
--
Michal Hocko
SUSE Labs
prev parent reply other threads:[~2016-10-21 14:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <580987f2.JsdBOQG1KdULbbHg%akpm@linux-foundation.org>
2016-10-21 13:44 ` Alexey Dobriyan
2016-10-21 14:14 ` 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=20161021141453.GN6045@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=adobriyan@gmail.com \
--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=mm-commits@vger.kernel.org \
--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
all inboxes | Powered by JetHome®