diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2014-02-01 18:28:36 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2014-07-14 11:09:59 -0700 |
commit | c9bbee954bfabfc1fec46cc4c3753a98eb0f8264 (patch) | |
tree | 761bec1b817fadd009b474567bdc00ecae874312 /usr/src | |
parent | 5e74f94d8c2a16c2ef7cf2940a157ffabb379c27 (diff) | |
download | illumos-gate-c9bbee954bfabfc1fec46cc4c3753a98eb0f8264.tar.gz |
4997 kstat_install()/header_kstat_snapshot() race induces panic
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/uts/common/os/kstat_fr.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/uts/common/os/kstat_fr.c b/usr/src/uts/common/os/kstat_fr.c index fb5333921d..31ba702346 100644 --- a/usr/src/uts/common/os/kstat_fr.c +++ b/usr/src/uts/common/os/kstat_fr.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright 2013, Joyent, Inc. All rights reserved. + * Copyright 2014, Joyent, Inc. All rights reserved. */ /* @@ -1210,8 +1210,16 @@ kstat_install(kstat_t *ksp) /* * Now that the kstat is active, make it visible to the kstat driver. + * When copying out kstats the count is determined in + * header_kstat_update() and actually copied into kbuf in + * header_kstat_snapshot(). kstat_chain_lock is held across the two + * calls to ensure that this list doesn't change. Thus, we need to + * also take the lock to ensure that the we don't copy the new kstat + * in the 2nd pass and overrun the buf. */ + mutex_enter(&kstat_chain_lock); ksp->ks_flags &= ~KSTAT_FLAG_INVALID; + mutex_exit(&kstat_chain_lock); kstat_rele(ksp); } |