freebsd-dev/sys/compat/linuxkpi/common
Hans Petter Selasky b764a42653 There is a window where threads are removed from the process list and where
the thread destructor is invoked. Catch that window by waiting for all
task_struct allocations to be returned before freeing the UMA zone in the
LinuxKPI. Else UMA may fail to release the zone due to concurrent access
and panic:

panic() - Bad link element prev->next != elm
zone_release()
bucket_drain()
bucket_free()
zone_dtor()
zone_free_item()
uma_zdestroy()
linux_current_uninit()

This failure can be triggered by loading and unloading the LinuxKPI module
in a loop:

while true
do
kldload linuxkpi
kldunload linuxkpi
done

Discussed with:	kib@
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-05-21 13:18:41 +02:00
..
include Implement cdev_device_add() and cdev_device_del() in the LinuxKPI. 2021-05-11 21:00:23 +02:00
src There is a window where threads are removed from the process list and where 2021-05-21 13:18:41 +02:00