CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2020/03/02 10:07:50
Modified files:
sys/kern : kern_rwlock.c
Log message:
Fix use of WITNESS_UNLOCK() in rw_exit_read() and rw_exit_write().
WITNESS_UNLOCK() has to be called before the actual lock is released.
Otherwise, the checker would trigger a use-after-free if the rwlock was
dynamically allocated and another thread freed it too early.
In addition to fixing the lock release issue, this patch does
the following improvements:
* membar_exit_before_atomic() is now invoked only once per lock release.
* rwl_owner is read as late as possible to make rw_cas() failure
less likely.
* The rw_cas() of rw_exit() (now rw_do_exit()) is put inside
__predict_false(). This compacts the resulting machine code a bit.
Tested by and OK anton@
OK mpi@