From 785199575944f5ec9d198c04eae287e7ca190bf4 Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 8 Sep 2008 21:40:15 +0000 Subject: - Reduce scope of #ifdef's in uma_zcreate() call in init_turnstile0(). - Set UMA_ZONE_NOFREE so that the per-turnstile spin locks are type stable to avoid a race where one thread might dereference a lock in a free'd turnstile that was previously used by another thread. Theorized by: tegge (2) MFC after: 1 week --- sys/kern/subr_turnstile.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/kern/subr_turnstile.c b/sys/kern/subr_turnstile.c index 7b8270a..6d96aa3 100644 --- a/sys/kern/subr_turnstile.c +++ b/sys/kern/subr_turnstile.c @@ -396,12 +396,13 @@ init_turnstile0(void *dummy) { turnstile_zone = uma_zcreate("TURNSTILE", sizeof(struct turnstile), + NULL, #ifdef INVARIANTS - NULL, turnstile_dtor, turnstile_init, turnstile_fini, - UMA_ALIGN_CACHE, 0); + turnstile_dtor, #else - NULL, NULL, turnstile_init, turnstile_fini, UMA_ALIGN_CACHE, 0); + NULL, #endif + turnstile_init, turnstile_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE); thread0.td_turnstile = turnstile_alloc(); } SYSINIT(turnstile0, SI_SUB_LOCK, SI_ORDER_ANY, init_turnstile0, NULL); -- cgit v1.1