lkml.org 
[lkml]   [2012]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] proc: fix null pointer deref in proc_pid_permission()
From
On Thu, Jan 12, 2012 at 6:41 AM, Kees Cook <keescook@chromium.org> wrote:
> On Wed, Jan 11, 2012 at 1:58 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
>> On Wed, 11 Jan 2012 12:43:30 -0800
>> Kees Cook <keescook@chromium.org> wrote:
>>> On Wed, Jan 11, 2012 at 01:47:05PM -0500, Xiaotian Feng wrote:
>>> > get_proc_task() can fail to search the task and return NULL, put_task_struct()
>>> > will then bomb the kernel with following oops:
>>> >
>>> > [ 1870.574045] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
>>> > [ 1870.574065] IP: [<ffffffff81217d34>] proc_pid_permission+0x64/0xe0
>>> > [ 1870.574088] PGD 112075067 PUD 112814067 PMD 0
>>> > [ 1870.574106] Oops: 0002 [#1] PREEMPT SMP
>>> >
>>> > This is a regression introduced by commit 0499680a, kernel should
>>> > return -ESRCH if get_proc_task() failed.
>>>
>>> Nice catch!
>>>
>>> However since this error is returned to userspace, shouldn't this be
>>> -ENOENT instead?
>>
>> Failed get_proc_task() frequently results in -ESRCH.  And less
>> frequently results in -ENOENT.
>>
>> It seems odd that inode_operations.permission() would ever return
>> anything other than zero or -EPERM.
>
> Right, but won't this show up at ESRCH from open(2)? If this is used
> as-is, we just need to have the manpages updated.
>

You're right, some of get_proc_task() returns -ENOENT. Maybe we should
return -ENOENT to avoid breaking userspace tools. Andrew?

> -Kees
>
> --
> Kees Cook
> ChromeOS Security
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2012-01-12 03:47    [W:0.056 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site