mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: "Chen Ridong" <chenridong@huawei.com>,
	cgroups@vger.kernel.org, "Aditya Kali" <adityakali@google.com>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Serge Hallyn" <sergeh@kernel.org>, "Tejun Heo" <tj@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Zefan Li" <lizefan.x@bytedance.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V4] cgroup/cpuset: Prevent UAF in proc_cpuset_show()
Date: Sun, 30 Jun 2024 11:20:58 +0200	[thread overview]
Message-ID: <e5a78840-b623-485c-b467-828a5a0b7d37@web.de> (raw)
In-Reply-To: <20240628013604.573498-1-chenridong@huawei.com>

…
> +++ 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

  parent reply	other threads:[~2024-06-30  9:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28  1:36 Chen Ridong
2024-06-28 17:11 ` Tejun Heo
2024-06-30  9:20 ` Markus Elfring [this message]
2024-06-30 17:03   ` Tejun Heo
2024-06-30 18:00     ` [V4] " Markus Elfring

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=e5a78840-b623-485c-b467-828a5a0b7d37@web.de \
    --to=markus.elfring@web.de \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huawei.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=sergeh@kernel.org \
    --cc=tj@kernel.org \
    /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®