diff options
author | jhb <jhb@FreeBSD.org> | 2008-09-08 21:40:15 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-09-08 21:40:15 +0000 |
commit | 785199575944f5ec9d198c04eae287e7ca190bf4 (patch) | |
tree | b14a4d38e35ee1c48ec4afb53415cc5394b5fe10 /sys/kern/subr_turnstile.c | |
parent | b484b97e7766f8d643ff205558ce5176240c6765 (diff) | |
download | FreeBSD-src-785199575944f5ec9d198c04eae287e7ca190bf4.zip FreeBSD-src-785199575944f5ec9d198c04eae287e7ca190bf4.tar.gz |
- 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
Diffstat (limited to 'sys/kern/subr_turnstile.c')
-rw-r--r-- | sys/kern/subr_turnstile.c | 7 |
1 files 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); |