From: Al Viro <viro@ZenIV.linux.org.uk>
To: Leon Yu <chianglungyu@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>,
Oleg Nesterov <oleg@redhat.com>, Michal Hocko <mhocko@suse.com>,
John Stultz <john.stultz@linaro.org>,
Mateusz Guzik <mguzik@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: Wed, 19 Oct 2016 15:20:15 +0100 [thread overview]
Message-ID: <20161019142015.GG19539@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1476885580-7612-1-git-send-email-chianglungyu@gmail.com>
On Wed, Oct 19, 2016 at 09:59:40PM +0800, Leon Yu wrote:
> Reading auxv of any kernel thread results in NULL pointer dereferencing in
> auxv_read() where mm can be NULL or even error code. Fix that by testing mm
> with IS_ERR_OR_NULL() helper. This is also the original behavior changed by
> recent commit c5317167854e ("proc: switch auxv to use of __mem_open()").
What the... How can it be ERR_PTR(...) after it has passed __mem_open()?
I agree that we ought to check for NULL mm (the only question is whether it's
best done by failing open() or by treating the file as empty), but this
IS_ERR_OR_NULL() is pure cargo-cult, AFAICS.
next prev parent reply other threads:[~2016-10-19 14:20 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 [this message]
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
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=20161019142015.GG19539@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--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=mhocko@suse.com \
--cc=oleg@redhat.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