util: Detect use-after-destroy in simple_mtx
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 21 Oct 2019 21:51:13 +0000 (14:51 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 10 Dec 2019 23:48:40 +0000 (23:48 +0000)
commit74665eaf3a44d3af5a136996ccbe39035306e8e5
treed67042a3be098d562e0344db65b2fce658de941c
parentfc97643c575d87ce60ccdf92c34bfac800ed9ab5
util: Detect use-after-destroy in simple_mtx

This makes simple_mtx_destroy set the counter to an invalid canary
value and then makes lock/unlock assert that the value is legal.

That way, calling lock/unlock after destroy will assert fail,
rather than deadlocking or potentially even working.

This has caught real deadlocks in dEQP multithreaded tests (in st/mesa
shader variant zombie list handling), which have since been fixed.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
src/util/simple_mtx.h