mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
Cc: Zefan Li <lizefan.x@bytedance.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cgroup: Protect css->cgroup write under css_set_lock
Date: Wed, 3 Jul 2024 08:59:41 -1000	[thread overview]
Message-ID: <ZoWfnS6NvEoNckGO@slm.duckdns.org> (raw)
In-Reply-To: <20240703185229.1849423-1-longman@redhat.com>

On Wed, Jul 03, 2024 at 02:52:29PM -0400, Waiman Long wrote:
> The writing of css->cgroup associated with the cgroup root in
> rebind_subsystems() is currently protected only by cgroup_mutex.
> However, the reading of css->cgroup in both proc_cpuset_show() and
> proc_cgroup_show() is protected just by css_set_lock. That makes the
> readers susceptible to racing problems like data tearing or caching.
> It is also a problem that can be reported by KCSAN.
> 
> This can be fixed by using READ_ONCE() and WRITE_ONCE() to access
> css->cgroup. Alternatively, the writing of css->cgroup can be moved
> under css_set_lock as well which is done by this patch.
> 
> Signed-off-by: Waiman Long <longman@redhat.com>

Applied to cgroup/for-6.10-fixes.

Thanks.

-- 
tejun

      reply	other threads:[~2024-07-03 18:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03 18:52 Waiman Long
2024-07-03 18:59 ` Tejun Heo [this message]

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=ZoWfnS6NvEoNckGO@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    /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®