linux-stable/fs/proc
Oleg Nesterov 4fe85bdaab fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats
commit 7601df8031 upstream.

lock_task_sighand() can trigger a hard lockup.  If NR_CPUS threads call
do_task_stat() at the same time and the process has NR_THREADS, it will
spin with irqs disabled O(NR_CPUS * NR_THREADS) time.

Change do_task_stat() to use sig->stats_lock to gather the statistics
outside of ->siglock protected section, in the likely case this code will
run lockless.

Link: https://lkml.kernel.org/r/20240123153357.GA21857@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Dylan Hatch <dylanbhatch@google.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: David Sauerwein <dssauerw@amazon.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-02 07:41:09 +02:00
..
array.c fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats 2025-05-02 07:41:09 +02:00
base.c fs/procfs: fix the comment above proc_pid_wchan() 2025-04-10 14:30:59 +02:00
bootconfig.c
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c proc: fix UAF in proc_get_inode() 2025-04-10 14:30:53 +02:00
inode.c proc: fix UAF in proc_get_inode() 2025-04-10 14:30:53 +02:00
internal.h proc: fix UAF in proc_get_inode() 2025-04-10 14:30:53 +02:00
interrupts.c
Kconfig
kcore.c
kmsg.c
loadavg.c
Makefile
meminfo.c
namespaces.c
nommu.c
page.c
proc_net.c
proc_sysctl.c
proc_tty.c
root.c
self.c
softirqs.c
stat.c
task_mmu.c
task_nommu.c
thread_self.c
uptime.c
util.c
version.c
vmcore.c fs/proc: fix softlockup in __read_vmcore (part 2) 2025-02-01 18:22:29 +01:00