Messages in this thread | | | Date | Mon, 31 Aug 2020 16:21:30 -0700 | From | "Paul E. McKenney" <> | Subject | Re: Question on task_blocks_on_rt_mutex() |
| |
On Mon, Aug 31, 2020 at 03:49:11PM -0700, Paul E. McKenney wrote: > Hello! > > The task_blocks_on_rt_mutex() function uses rt_mutex_owner() to > take a snapshot of the lock owner right up front. At this point, > the ->wait_lock is held, which at first glance prevents the owner > from leaving. Except that if there are not yet any waiters (that is, > the low-order bit of ->owner is zero), rt_mutex_fastunlock() might > locklessly clear the ->owner field. And in that case, it looks like > task_blocks_on_rt_mutex() will blithely continue using the ex-owner's > task_struct structure, without anything that I can see that prevents > the ex-owner from exiting. > > What am I missing here?
One thing I missed is that the low-order bit of ->owner would already be set by this point.
> The reason that I am looking into this is that locktorture scenario LOCK05 > hangs, and does so leaving the torture_rtmutex.waiters field equal to 0x1. > This is of course a legal transitional state, but I would not expect it > to persist for more than three minutes. Yet it often does. > > This leads me to believe that there is a way for an unlock to fail to wake > up a task concurrently acquiring the lock. This seems to be repaired > by later lock acquisitions, and in fact setting the locktorture.stutter > module parameter to zero avoids the hang. Except that I first found the > above apparently unprotected access to what was recently the owner task. > > Thoughts?
Some breakage elsewhere, presumably...
Thanx, Paul
| |