Re: [PATCH 4.4 00/11] Fix a potential infinite loop in RT futex-pi scenarios

From: Joe Korty
Date: Mon Aug 02 2021 - 20:54:08 EST


On Mon, Aug 02, 2021 at 09:46:13PM +0800, Zhen Lei wrote:
> Commit 73d786bd043e "futex: Rework inconsistent rt_mutex/futex_q state"
> mentions that it could cause an infinite loop, and will fix it in the later
> patches:
> bebe5b514345f09 futex: Futex_unlock_pi() determinism
> cfafcd117da0216 futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()
>
> But at the moment they're not backported. In a single-core environment, the
> probability of triggering is high.
>
> I also backported commit b4abf91047cf ("rtmutex: Make wait_lock irq safe"),
> it fixes a potential deadlock problem. Although it hasn't actually been
> triggered in our environment at the moment.
>
> Other patches are used to resolve conflicts or fix problems caused by new
> patches.
>
>
> Anna-Maria Gleixner (1):
> rcu: Update documentation of rcu_read_unlock()
>
> Mike Galbraith (1):
> futex: Handle transient "ownerless" rtmutex state correctly
>
> Peter Zijlstra (6):
> futex: Cleanup refcounting
> futex,rt_mutex: Introduce rt_mutex_init_waiter()
> futex: Pull rt_mutex_futex_unlock() out from under hb->lock
> futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()
> futex: Futex_unlock_pi() determinism
> futex,rt_mutex: Fix rt_mutex_cleanup_proxy_lock()
>
> Thomas Gleixner (3):
> futex: Rename free_pi_state() to put_pi_state()
> rtmutex: Make wait_lock irq safe
> futex: Avoid freeing an active timer
>
> include/linux/rcupdate.h | 4 +-
> kernel/futex.c | 245 +++++++++++++++++++++-----------
> kernel/locking/rtmutex.c | 185 +++++++++++++-----------
> kernel/locking/rtmutex_common.h | 2 +-
> 4 files changed, 262 insertions(+), 174 deletions(-)


To all concerned,

I have verified that this series of patches, when applied
to 4.4.277, passes the futex-unlock-pi replicator I posted
to lkml on July 19.

Subject: [BUG] 4.4.262: infinite loop in futex_unlock_pi (EAGAIN loop)

Acked-by: Joe Korty <joe.korty@xxxxxxxxxxxxxxxxx>