On 06/26/2017 08:20 AM, Kamil Rytarowski wrote:
On 25.06.2017 20:34, Taylor R Campbell wrote:
Sleeping with a spin lock held is absolutely prohibited and does not
work.

An example of this abuse is described here:

https://mail-index.netbsd.org/current-users/2014/07/19/msg025295.html

Jia-Ju, can you detect bugs like this one?

Hi,

In fact, I have written a static tool to detect sleep-in-interrupt and sleep-in-spin-mutex (sleep between "mutex_spin_enter" and "mutex_spin_exit") bugs in NetBSD kernel code. And I have found some bugs, and examples are here:

http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=52330
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=52331
http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=52333

Meanwhile, in your link (https://mail-index.netbsd.org/current-users/2014/07/19/msg025295.html), "KERNEL_LOCK" and "KERNEL_UNLOCK" can be regarded as "mutex_spin_enter" and "mutex_spin_exit"? I also find that the code in your link has function pointer, but my static tool can not handle function pointer in current implementation, and I will add related support for it in next implementation.

Thanks,
Jia-Ju Bai



Reply via email to