Re: [PATCH V4] cgroup/cpuset: Prevent UAF in proc_cpuset_show()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux