From: Tejun Heo <tj@kernel.org>
To: Li Zefan <lizefan@huawei.com>
Cc: Michal Hocko <mhocko@suse.cz>,
LKML <linux-kernel@vger.kernel.org>,
Cgroups <cgroups@vger.kernel.org>
Subject: Re: [PATCH] cgroup: protect modifications to cgroup_idr with cgroup_mutex
Date: Tue, 11 Feb 2014 10:36:30 -0500 [thread overview]
Message-ID: <20140211153630.GB24490@htj.dyndns.org> (raw)
In-Reply-To: <52F9D9DA.7040108@huawei.com>
On Tue, Feb 11, 2014 at 04:05:46PM +0800, Li Zefan wrote:
> Setup cgroupfs like this:
> # mount -t cgroup -o cpuacct xxx /cgroup
> # mkdir /cgroup/sub1
> # mkdir /cgroup/sub2
>
> Then run these two commands:
> # for ((; ;)) { mkdir /cgroup/sub1/tmp && rmdir /mnt/sub1/tmp; } &
> # for ((; ;)) { mkdir /cgroup/sub2/tmp && rmdir /mnt/sub2/tmp; } &
>
> After seconds you may see this warning:
>
> ------------[ cut here ]------------
> WARNING: CPU: 1 PID: 25243 at lib/idr.c:527 sub_remove+0x87/0x1b0()
> idr_remove called for id=6 which is not allocated.
> ...
> Call Trace:
> [<ffffffff8156063c>] dump_stack+0x7a/0x96
> [<ffffffff810591ac>] warn_slowpath_common+0x8c/0xc0
> [<ffffffff81059296>] warn_slowpath_fmt+0x46/0x50
> [<ffffffff81300aa7>] sub_remove+0x87/0x1b0
> [<ffffffff810f3f02>] ? css_killed_work_fn+0x32/0x1b0
> [<ffffffff81300bf5>] idr_remove+0x25/0xd0
> [<ffffffff810f2bab>] cgroup_destroy_css_killed+0x5b/0xc0
> [<ffffffff810f4000>] css_killed_work_fn+0x130/0x1b0
> [<ffffffff8107cdbc>] process_one_work+0x26c/0x550
> [<ffffffff8107eefe>] worker_thread+0x12e/0x3b0
> [<ffffffff81085f96>] kthread+0xe6/0xf0
> [<ffffffff81570bac>] ret_from_fork+0x7c/0xb0
> ---[ end trace 2d1577ec10cf80d0 ]---
>
> It's because allocating/removing cgroup ID is not properly synchronized.
>
> The bug was introduced when we converted cgroup_ida to cgroup_idr.
> While synchronization is already done inside ida_simple_{get,remove}(),
> users are responsible for concurrent calls to idr_{alloc,remove}().
>
> Fixes: 4e96ee8e981b ("cgroup: convert cgroup_ida to cgroup_idr")
> Cc: <stable@vger.kernel.org> #3.12+
> Reported-by: Michal Hocko <mhocko@suse.cz>
> Signed-off-by: Li Zefan <lizefan@huawei.com>
Jesus, you're right. I missed that completely. It conflicts with the
return value fix in cgroup/for-3.14-fixes but easy to fix up.
Applying to cgroup/for-3.14-fixes.
Thanks!
--
tejun
next prev parent reply other threads:[~2014-02-11 15:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-11 8:05 Li Zefan
2014-02-11 10:20 ` Michal Hocko
2014-02-12 1:50 ` Li Zefan
2014-02-12 9:12 ` Michal Hocko
2014-02-12 9:26 ` Li Zefan
2014-02-12 9:38 ` Michal Hocko
2014-02-11 15:36 ` Tejun Heo [this message]
2014-02-11 15:41 ` [PATCH cgroup/for-3.14-fixes] " Tejun Heo
2014-02-11 16:26 ` Michal Hocko
2014-02-12 2:15 ` Li Zefan
2014-02-12 2:32 ` Li Zefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140211153630.GB24490@htj.dyndns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mhocko@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®