As reported in review D4893, it is possible for a knote list lock to be held forever. The sequence of events is: Thread 1 obtains the knlist lock. Thread 2 hits KN_LIST_LOCK(). It finds that kn->kn_knlist is non-NULL, so it waits to acquire the knlist lock. Thread 1 calls knlist_remove_kq(). This sets kn->kn_knlist to NULL. It then releases the knlist lock. Thread 2 obtains the knlist lock. Thread 2 hits KN_LIST_UNLOCK(). It finds that kn->kn_knlist is NULL, so it does not release the knlist lock. The fix seems to be to recheck kn->kn_knlist after acquiring the lock, and then immediately release the lock. The submitter of review D4893 is going to work on a patch.
I will work with the submitted of review D4893 to prepare a patch for review by the maintainer.
batch change: For bugs that match the following - Status Is In progress AND - Untouched since 2018-01-01. AND - Affects Base System OR Documentation DO: Reset to open status. Note: I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.