lkml.org 
[lkml]   [2016]   [Oct]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] proc: fix NULL dereference when reading /proc/<pid>/auxv
On Fri, Oct 21, 2016 at 3:21 AM, Michal Hocko <mhocko@kernel.org> wrote:
> On Thu 20-10-16 19:04:39, Oleg Nesterov wrote:
>> 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.
>
> I am not objecting to this particular patch as it is obviously correct.
> I was just hoping to have a more generic solution. The issue was
> introduced in this merge window so it is not like we would need as
> minimalistic approach possible. If the __mem_open approach sounds too
> dangerous I will not pursue it.
>
> Anyway feel free to add
> Acked-by: Michal Hocko <mhocko@suse.com>
> for this patch.

Many thanks to all reviewers involved in this discussion for your valueable
time and feedback.

-Leon

\
 
 \ /
  Last update: 2016-10-21 14:48    [W:0.066 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site