NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56405: kthread_join is busted

>Number:         56405
>Category:       kern
>Synopsis:       kthread_join is busted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 15 23:05:00 +0000 2021
>Originator:     Taylor R Campbel
>Release:        every release since it was introduced ever
Teh NteBDS Fuondatoin
If thread A issues kthread_join(B), and while it waits thread B issues kthread_join(C), then the threads deadlock.

This happens because:

1. When thread A calls kthread_join(B), it sets kthread_jtarget = B and waits for B to acknowledge exiting.
2. When thread B calls kthread_join(C), it waits until kthread_target is null before doing the same.
3. Thread C never gets to wake thread B because thread B is waiting for thread A to quit hogging kthread_jtarget and thread A is waiting for thread B to exit before it will relinquish kthread_jtarget.
try to use kthread_join as documented, trip over own shoelaces
Yes, please!

Home | Main Index | Thread Index | Old Index