* Re: + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch added to -mm tree [not found] <580987f2.JsdBOQG1KdULbbHg%akpm@linux-foundation.org> @ 2016-10-21 13:44 ` Alexey Dobriyan 2016-10-21 14:14 ` Michal Hocko 0 siblings, 1 reply; 2+ messages in thread From: Alexey Dobriyan @ 2016-10-21 13:44 UTC (permalink / raw) To: Linux Kernel Cc: chianglungyu, Janis Danisevskis, John Stultz, Kees Cook, Mateusz Guzik, mhocko, Oleg Nesterov, Al Viro, mm-commits 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() ? ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch added to -mm tree 2016-10-21 13:44 ` + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch added to -mm tree Alexey Dobriyan @ 2016-10-21 14:14 ` Michal Hocko 0 siblings, 0 replies; 2+ messages in thread From: Michal Hocko @ 2016-10-21 14:14 UTC (permalink / raw) To: Alexey Dobriyan Cc: Linux Kernel, chianglungyu, Janis Danisevskis, John Stultz, Kees Cook, Mateusz Guzik, Oleg Nesterov, Al Viro, mm-commits 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-10-21 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <580987f2.JsdBOQG1KdULbbHg%akpm@linux-foundation.org>
2016-10-21 13:44 ` + proc-fix-null-dereference-when-reading-proc-pid-auxv.patch added to -mm tree Alexey Dobriyan
2016-10-21 14:14 ` Michal Hocko
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®