[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5a78840-b623-485c-b467-828a5a0b7d37@web.de>
Date: Sun, 30 Jun 2024 11:20:58 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Chen Ridong <chenridong@...wei.com>, cgroups@...r.kernel.org,
Aditya Kali <adityakali@...gle.com>, Johannes Weiner <hannes@...xchg.org>,
Michal Koutný <mkoutny@...e.com>,
Serge Hallyn <sergeh@...nel.org>, Tejun Heo <tj@...nel.org>,
Waiman Long <longman@...hat.com>, Zefan Li <lizefan.x@...edance.com>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V4] cgroup/cpuset: Prevent UAF in proc_cpuset_show()
…
> +++ b/kernel/cgroup/cpuset.c
…
> @@ -5051,10 +5052,14 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
> if (!buf)
> goto out;
>
> - css = task_get_css(tsk, cpuset_cgrp_id);
> - retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX,
> - current->nsproxy->cgroup_ns);
> - css_put(css);
> + rcu_read_lock();
> + spin_lock_irq(&css_set_lock);
> + css = task_css(tsk, cpuset_cgrp_id);
> + retval = cgroup_path_ns_locked(css->cgroup, buf, PATH_MAX,
> + current->nsproxy->cgroup_ns);
> + spin_unlock_irq(&css_set_lock);
> + rcu_read_unlock();
…
Under which circumstances would you become interested to apply statements
like the following?
* guard(rcu)();
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/rcupdate.h#L1093
* guard(spinlock_irq)(&css_set_lock);
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/spinlock.h#L567
Regards,
Markus
Powered by blists - more mailing lists