linux-stable/kernel/cgroup
Michal Koutný 1c790191ca 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-19 23:05:37 +02:00
..
Makefile
cgroup-internal.h memcg: fix possible use-after-free in memcg_write_event_control() 2022-12-14 11:37:19 +01:00
cgroup-v1.c cgroup: Remove duplicates in cgroup v1 tasks file 2023-10-19 23:05:37 +02:00
cgroup.c sched/cpuset: Keep track of SCHED_DEADLINE task in cpusets 2023-08-30 16:18:20 +02:00
cpuset.c cgroup/cpuset: Free DL BW in case can_attach() fails 2023-08-30 16:18:20 +02:00
debug.c
freezer.c
legacy_freezer.c
misc.c
namespace.c cgroup:namespace: Remove unused cgroup_namespaces_init() 2023-09-19 12:22:47 +02:00
pids.c
rdma.c
rstat.c cgroup: Fix rootcg cpu.stat guest double counting 2021-11-18 19:16:45 +01:00