Re: cgroup: INFO: suspicious RCU usage. in cgroup_name

From: Li Zefan
Date: Thu Mar 07 2013 - 01:22:09 EST


On 2013/3/7 14:15, Michael Wang wrote:
> On 03/07/2013 12:02 AM, Sasha Levin wrote:
>> Hi all,
>>
>> While fuzzing with trinity inside a KVM tools guest running latest -next kernel
>> I've stumbled on the following:
>>
>> [ 450.180599] ===============================
>> [ 450.181392] [ INFO: suspicious RCU usage. ]
>> [ 450.182101] 3.9.0-rc1-next-20130305-sasha-00048-g35e9ec5-dirty #1032 Tainted: G W
>> [ 450.183482] -------------------------------
>> [ 450.184343] include/linux/cgroup.h:429 suspicious rcu_dereference_check() usage!
>> [ 450.185575]
>> [ 450.185575] other info that might help us debug this:
>> [ 450.185575]
>> [ 450.186961]
>> [ 450.186961] rcu_scheduler_active = 1, debug_locks = 1
>> [ 450.188001] 4 locks held by kworker/u:0/6:
>> [ 450.188646] #0: (khelper){.+.+.+}, at: [<ffffffff8112ba98>] process_one_work+0x238/0x570
>> [ 450.190186] #1: ((&sub_info->work)){+.+.+.}, at: [<ffffffff8112ba98>] process_one_work+0x238/0x570
>> [ 450.191824] #2: (&(&p->alloc_lock)->rlock){+.+.-.}, at: [<ffffffff812036d3>] dump_header+0x43/0xe0
>
> Hi, Sasha
>
> I suppose this is the warn context:
>
> cpuset_print_task_mems_allowed() -> task_cs() -> task_subsys_state()
>
> and this is the definition of task_subsys_state():
>
> #define task_subsys_state_check(task, subsys_id, __c) \
> rcu_dereference_check(task->cgroups->subsys[subsys_id], \
> lockdep_is_held(&task->alloc_lock) || \
> cgroup_lock_is_held() || (__c))
>
> the condition "lockdep_is_held(&task->alloc_lock)" should match (#2
> lock), the warn doesn't make sense to me...
>

nope..note this is 3.9-rc1-next, not 3.9-rc1.

The warning is from this:

/* Caller should hold rcu_read_lock() */
static inline const char *cgroup_name(const struct cgroup *cgrp)
{
return rcu_dereference(cgrp->name)->name;
}

I've cooked up a patch. Will send out today.

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