<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 12pt; color: #000000'><span>Greetings,<br><br>I recently have been looking at a crash in the stmf code, where a couple of <br>kstats appear to point to recycled kstat entries.  <br>(itl_kstat_info and itl_kstat_taskq)<br><br>The ks_module is "caps" instead of "stmf", and the ks_name is<br>"nprocs_task_xxx" instead of  the expected names. So that leads me to believe<br>these kstats has been freed/recycled.<br><br>This brings me to the question: would it not make sense to set any kstat<br>pointers to NULL after they have been freed? <br><br>Looking at the kstat_delete() implementation,  it seems like the natural place<br>to do this. <br><br>Arguably, the "right  solution" would be  to change the interface to kstat_delete()<br>from <br></span><pre><a class="l" name="1222" href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/kstat_fr.c#1222"></a><a href="http://src.opensolaris.org/source/s?refs=kstat_delete&project=onnv" class="d">-kstat_delete</a>(<a href="http://src.opensolaris.org/source/s?defs=kstat_t&project=onnv">kstat_t</a> *<a href="http://src.opensolaris.org/source/s?defs=ksp&project=onnv">ksp</a>)<br><a class="l" name="1222" href="http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/os/kstat_fr.c#1222"></a><a href="http://src.opensolaris.org/source/s?refs=kstat_delete&project=onnv" class="d">+kstat_delete</a>(<a href="http://src.opensolaris.org/source/s?defs=kstat_t&project=onnv">kstat_t</a> **<a href="http://src.opensolaris.org/source/s?defs=ksp&project=onnv">ksp</a>)<br></pre><span id="82eb4e1e-c3de-47bc-86fc-b660f5386f6d"> so that it can set the *ksp to NULL when it is done freeing the memory <br>that it points to.  <br><br>Unfortunately kstat_delete() is called in 170 places.<br><br>This is clearly  a problem.. Any opinions?<br><br><br>Steve<br> <br><br> <br><br>/sG/<br></span></div></body></html>