[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lvfxjlx6gok6lhwvf2h3reiizfztjfsyuspa7avzog6fbuozsq@bqpqe5g4fj5j>
Date: Tue, 29 Jul 2025 11:42:30 +0200
From: Michal Koutný <mkoutny@...e.com>
To: JP Kobryn <inwardvessel@...il.com>
Cc: tj@...nel.org, shakeel.butt@...ux.dev, yosryahmed@...gle.com,
hannes@...xchg.org, akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org, kernel-team@...a.com
Subject: Re: [PATCH 0/5 cgroup/for-6.16-fixes] harden css_create() for safe
placement of call to css_rstat_init()
On Mon, Jul 28, 2025 at 11:04:56AM -0700, JP Kobryn <inwardvessel@...il.com> wrote:
> I did consider adding an "initialized" flag to the css but since there can
> be multiple css's per
> cgroup it felt like it would be adding overhead. So I went the path of
> getting the call
> sequence right. I'm open to feedback on this, though.
An implicit flag that builds upon the assumption that css_rstat_init()
must only succeed after it allocates ->rstat_cpu (didn't check gotchas
of this approach with !CONFIG_SMP)
--- a/kernel/cgroup/rstat.c
+++ b/kernel/cgroup/rstat.c
@@ -488,6 +488,10 @@ void css_rstat_exit(struct cgroup_subsys_state *css)
if (!css_uses_rstat(css))
return;
+ /* Incomplete css whose css_rstat_init failed */
+ if (!css->rstat_cpu)
+ return;
+
css_rstat_flush(css);
/* sanity check */
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists