Re: [PATCH] stackdepot: fix stack_depot_save_flags() in NMI context
From: Andrew Morton
Date: Wed Nov 27 2024 - 20:25:28 EST
On Fri, 22 Nov 2024 16:39:47 +0100 Marco Elver <elver@xxxxxxxxxx> wrote:
> Per documentation, stack_depot_save_flags() was meant to be usable from
> NMI context if STACK_DEPOT_FLAG_CAN_ALLOC is unset. However, it still
> would try to take the pool_lock in an attempt to save a stack trace in
> the current pool (if space is available).
>
> This could result in deadlock if an NMI is handled while pool_lock is
> already held. To avoid deadlock, only try to take the lock in NMI
> context and give up if unsuccessful.
Is it possible to trigger this deadlock in current kernels, or is this
a might-happen-in-the-future thing?
> The documentation is fixed to clearly convey this.
>