linux-stable/kernel/cgroup
Michal Koutný 2a4a828040 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:54:16 +02:00
..
cgroup-internal.h memcg: fix possible use-after-free in memcg_write_event_control() 2022-12-14 11:31:57 +01:00
cgroup-v1.c cgroup: Remove duplicates in cgroup v1 tasks file 2023-10-25 11:54:16 +02:00
cgroup.c sched/cpuset: Keep track of SCHED_DEADLINE task in cpusets 2023-08-30 16:23:17 +02:00
cpuset.c cgroup/cpuset: Free DL BW in case can_attach() fails 2023-08-30 16:23:18 +02:00
debug.c
freezer.c cgroup: freezer: don't change task and cgroups status unnecessarily 2019-11-07 07:38:41 -08:00
legacy_freezer.c
Makefile
namespace.c cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-09-19 12:20:19 +02:00
pids.c clone3: allow spawning processes into cgroups 2020-02-12 17:57:51 -05:00
rdma.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 451 2019-06-19 17:09:08 +02:00
rstat.c cgroup: Fix rootcg cpu.stat guest double counting 2021-11-18 14:04:13 +01:00