lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 23 Jan 2024 16:53:49 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
	Dylan Hatch <dylanbhatch@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] getrusage: use sig->stats_lock rather than
 lock_task_sighand()

On 01/22, Andrew Morton wrote:
>
> On Mon, 22 Jan 2024 16:50:53 +0100 Oleg Nesterov <oleg@...hat.com> wrote:
>
> > lock_task_sighand() can trigger a hard lockup. If NR_CPUS threads call
> > getrusage() at the same time and the process has NR_THREADS, spin_lock_irq
> > will spin with irqs disabled O(NR_CPUS * NR_THREADS) time.
>
> It would be super interesting to see Dylan's original report.

from "[RFC PATCH] getrusage: Use trylock when getting sighand lock."
https://lore.kernel.org/all/20240117192534.1327608-1-dylanbhatch@google.com/

	Processes with many threads run the risk of causing a hard lockup if
	too many threads are calling getrusage() at once. This is because a
	calling thread with RUSAGE_SELF spins on the sighand lock with irq
	disabled, and the critical section of getrusage scales linearly with the
	size of the process. All cpus may end up spinning on the sighand lock
	for a long time because another thread has the lock and is busy
	iterating over 250k+ threads.

> Is it possible for carefully-crafted unprivileged userspace to
> deliberately trigger this?

Yes, just you need to create a process with a lot of threads calling
getrusage().

See mine and Dylan's test-cases in
https://lore.kernel.org/all/CADBMgpz7k=LhktfcJhSDBDWN0oLeQxPqhOVws3fq0LNpnfOSYg@mail.gmail.com/
There are very similar and simple.


And again, this is a known problem and we need more fixes.

Oleg.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ