lkml.org 
[lkml]   [2013]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [userns-always-map-user-v136] BUG: unable to handle kernel NULL pointer dereference at (null)
Fengguang Wu <fengguang.wu@intel.com> writes:

> Hi Eric,
>
> It's beyond me why this trivial patch will lead to kernel panic. But
> the NULL pointer dereference bug is 100% reproducible since this
> commit.

My mistake apparently I failed to boot test that patch.

The problem crash is because
kthreadd_task == NULL.

kthreadd_task is NULL because this little sequence sets kthreadd_task to NULL

pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
rcu_read_unlock();

The lookup for kthreadd_task fails because when spawning kthread_task
with kernel_thread the is_idle_task(p) test in fork is reporting true,
so the pid is never placed into the pid hash table.

is_idle_task(p) is true because it is testing task_pid(p) two lines
before task_pid(p) is set. So task_pid(p) is still it's parents value
and the parent of the kthreadd_task is the initial idle task.

So I should have just tested (pid != &init_struct_pid) sigh. Silly me.

Fixed and pushed out. That you for reporting this to me.

Eric


\
 
 \ /
  Last update: 2013-10-20 06:21    [W:0.034 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site