public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
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>, 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 v2] proc: fix NULL dereference when reading /proc/<pid>/auxv
Date: Thu, 20 Oct 2016 19:04:39 +0200	[thread overview]
Message-ID: <20161020170438.GA13724@redhat.com> (raw)
In-Reply-To: <1476966200-14457-1-git-send-email-chianglungyu@gmail.com>

On 10/20, Leon Yu wrote:
>
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -1014,6 +1014,9 @@ static ssize_t auxv_read(struct file *file, char __user *buf,
>  {
>  	struct mm_struct *mm = file->private_data;
>  	unsigned int nwords = 0;
> +
> +	if (!mm)
> +		return 0;
>  	do {
>  		nwords += 2;
>  	} while (mm->saved_auxv[nwords - 2] != 0); /* AT_NULL */

Michal disagrees and I won't argue with his patch which makes __mem_open()
fail if ->mm == NULL. Even if I don't really understand why should we change
the old behaviour, this _can_ break or at least confuse something/someone.

However, even if we do the change above, personally I do think we should
fix the trivial bug first, then surprise the user-space.

Acked-by: Oleg Nesterov <oleg@redhat.com>

  reply	other threads:[~2016-10-20 17:06 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
2016-10-20 12:23 ` [PATCH v2] " Leon Yu
2016-10-20 17:04   ` Oleg Nesterov [this message]
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=20161020170438.GA13724@redhat.com \
    --to=oleg@redhat.com \
    --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=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