linux-stable/fs/proc
Oleg Nesterov cf4b8c39b9 fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats
[ Upstream commit 7601df8031 ]

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>
2024-03-15 10:48:22 -04:00
..
Kconfig
Makefile
array.c fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats 2024-03-15 10:48:22 -04:00
base.c procfs: block chmod on /proc/thread-self/comm 2023-09-13 09:43:02 +02:00
bootconfig.c
cmdline.c
consoles.c
cpuinfo.c
devices.c
fd.c
fd.h
generic.c
inode.c
internal.h proc: nommu: fix empty /proc/<pid>/maps 2023-10-06 14:56:42 +02:00
interrupts.c
kcore.c
kmsg.c printk changes for 6.1 2022-10-10 11:24:19 -07:00
loadavg.c
meminfo.c proc/meminfo: fix spacing in SecPageTables 2022-11-22 18:50:44 -08:00
namespaces.c
nommu.c
page.c
proc_net.c
proc_sysctl.c watchdog: move softlockup_panic back to early_param 2023-11-28 17:07:09 +00:00
proc_tty.c
root.c
self.c
softirqs.c
stat.c
task_mmu.c mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps 2023-02-09 11:28:20 +01:00
task_nommu.c proc: nommu: fix empty /proc/<pid>/maps 2023-10-06 14:56:42 +02:00
thread_self.c
uptime.c
util.c
version.c
vmcore.c proc/vmcore: fix signedness bug in read_from_oldmem() 2023-08-03 10:24:14 +02:00