Re: [PATCH -next] cgroup: fix uaf when proc_cpuset_show

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

 




On 2024/6/22 21:45, Markus Elfring wrote:
We found a refcount UAF bug as follows:

BUG: KASAN: use-after-free in cgroup_path_ns+0x112/0x150
…

How do you think about to use a summary phrase like “Avoid use-after-free
in proc_cpuset_show()”?


This is also reported by: https://syzkaller.appspot.com/bug?extid=9b1ff7be974a403aa4cd
Would you like to add any tags (like “Fixes”) accordingly?

Thank you for review, i will do that.
+++ b/kernel/cgroup/cpuset.c
@@ -5052,9 +5053,28 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
  		goto out;

  	css = task_get_css(tsk, cpuset_cgrp_id);
+	rcu_read_lock();
+	rcu_read_unlock();
  	retval = cgroup_path_ns(css->cgroup, buf, PATH_MAX,
  				current->nsproxy->cgroup_ns);
…

Would you become interested to apply a statement like “guard(rcu_read_lock)();”?
https://elixir.bootlin.com/linux/v6.10-rc4/source/include/linux/cleanup.h#L133

Regards,
Markus

We hope somebody could have another better solution.

Regards

Ridong







[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