From: Tejun Heo Subject: Re: [PATCH cgroup/for-3.11 1/3] cgroup: fix RCU accesses to task->cgroups Date: Wed, 26 Jun 2013 10:49:36 -0700 Message-ID: <20130626174936.GE4405@mtj.dyndns.org> References: <20130621225116.GC3949@htj.dyndns.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=+XeCv5eTX8XWGzFnla3oxDtyXTNfUmMRHvJxvabRhy8=; b=p3yHlcHjumED5X6HekMzCnHmVIKStzPlO43RX5nPImdc4inNRtz9jL5ottzgi/9jkd kitiCSg8bHUy40qaUq7LK0/JRw3WM78qLHodeTHmxgUcc+sHt7NknUZHuG2oLOLARvKQ FhBUcF/3p7IiZOya875SmMR64mhHyFKb+tiy8fvym4tu2XB/WgYkzcmIR6oPvdtu5pTw f1Oe1xOmI2WddQtUXqSy8ZonFxOR/sA8+xnC9L+HrzPeFsWcWoy3v9NhQpajZVDfZA+W l0UfwR1EzFHrRTix2+hYYHSEYDXWgpNXojFoWtugHAmoTI56h0ZSbhAA3AEnxXqirrLs NmpA== Content-Disposition: inline In-Reply-To: <20130621225116.GC3949-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Tejun Heo Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Fengguang Wu On Fri, Jun 21, 2013 at 03:51:17PM -0700, Tejun Heo wrote: > task->cgroups is a RCU pointer pointing to struct css_set. A task > switches to a different css_set on cgroup migration but a css_set > doesn't change once created and its pointers to cgroup_subsys_states > aren't RCU protected. > > task_subsys_state[_check]() is the macro to acquire css given a task > and subsys_id pair. It RCU-dereferences task->cgroups->subsys[] not > task->cgroups, so the RCU pointer task->cgroups ends up being > dereferenced without read_barrier_depends() after it. It's broken. > > Fix it by introducing task_css_set[_check]() which does > RCU-dereference on task->cgroups. task_subsys_state[_check]() is > reimplemented to directly dereference ->subsys[] of the css_set > returned from task_css_set[_check](). > > This removes some of sparse RCU warnings in cgroup. > > Signed-off-by: Tejun Heo > Reported-by: Fengguang Wu > Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Applied 1-3 to cgroup/for-3.11. Thanks. -- tejun