[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20161021141453.GN6045@dhcp22.suse.cz>
Date: Fri, 21 Oct 2016 16:14:54 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Linux Kernel <linux-kernel@...r.kernel.org>,
chianglungyu@...il.com, Janis Danisevskis <jdanis@...gle.com>,
John Stultz <john.stultz@...aro.org>,
Kees Cook <keescook@...omium.org>,
Mateusz Guzik <mguzik@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>, mm-commits@...r.kernel.org
Subject: Re: + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch
added to -mm tree
On Fri 21-10-16 16:44:03, Alexey Dobriyan wrote:
> On Fri, Oct 21, 2016 at 6:13 AM, <akpm@...ux-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
Powered by blists - more mailing lists