linux-stable/kernel/cgroup
Michal Koutný d5b11bd893 cgroup: Remove duplicates in cgroup v1 tasks file
commit 1ca0b60515 upstream.

One PID may appear multiple times in a preloaded pidlist.
(Possibly due to PID recycling but we have reports of the same
task_struct appearing with different PIDs, thus possibly involving
transfer of PID via de_thread().)

Because v1 seq_file iterator uses PIDs as position, it leads to
a message:
> seq_file: buggy .next function kernfs_seq_next did not update position index

Conservative and quick fix consists of removing duplicates from `tasks`
file (as opposed to removing pidlists altogether). It doesn't affect
correctness (it's sufficient to show a PID once), performance impact
would be hidden by unconditional sorting of the pidlist already in place
(asymptotically).

Link: https://lore.kernel.org/r/20230823174804.23632-1-mkoutny@suse.com/
Suggested-by: Firo Yang <firo.yang@suse.com>
Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25 11:53:19 +02:00
..
cgroup-internal.h memcg: fix possible use-after-free in memcg_write_event_control() 2022-12-14 11:30:43 +01:00
cgroup-v1.c cgroup: Remove duplicates in cgroup v1 tasks file 2023-10-25 11:53:19 +02:00
cgroup.c cgroup: Do not corrupt task iteration when rebinding subsystem 2023-06-28 10:18:36 +02:00
cpuset.c cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() 2023-04-20 12:07:32 +02:00
debug.c
freezer.c cgroup: freezer: don't change task and cgroups status unnecessarily 2019-12-31 16:45:06 +01:00
legacy_freezer.c
Makefile
namespace.c
pids.c
rdma.c
rstat.c Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" 2020-06-07 13:18:46 +02:00