--- /dev/null
+ o Minor features (diagnostic):
+ - Improve assertions and add some memory-poisoning code to try to track
+ down possible causes of a rare crash (32564) in the EWMA code.
+ Closes ticket 33290.
#include "core/or/destroy_cell_queue_st.h"
#include "core/or/or_circuit_st.h"
+#include "lib/crypt_ops/crypto_util.h"
+
/*
* Private typedefs for circuitmux.c
*/
/* Now remove it from the map */
HT_REMOVE(chanid_circid_muxinfo_map, cmux->chanid_circid_map, hashent);
- /* Free the hash entry */
+ /* Wipe and free the hash entry */
+ // This isn't sensitive, but we want to be sure to know if we're accessing
+ // this accidentally.
+ memwipe(hashent, 0xef, sizeof(hashent));
tor_free(hashent);
}
}
return 0;
}
}
-
{
if (!pol) return NULL;
else {
- tor_assert(pol->magic == EWMA_POL_DATA_MAGIC);
+ tor_assertf(pol->magic == EWMA_POL_DATA_MAGIC,
+ "Mismatch: %"PRIu32" != %"PRIu32,
+ pol->magic, EWMA_POL_DATA_MAGIC);
return DOWNCAST(ewma_policy_data_t, pol);
}
}
{
if (!pol) return NULL;
else {
- tor_assert(pol->magic == EWMA_POL_CIRC_DATA_MAGIC);
+ tor_assertf(pol->magic == EWMA_POL_CIRC_DATA_MAGIC,
+ "Mismatch: %"PRIu32" != %"PRIu32,
+ pol->magic, EWMA_POL_CIRC_DATA_MAGIC);
return DOWNCAST(ewma_policy_circ_data_t, pol);
}
}
pol = TO_EWMA_POL_DATA(pol_data);
smartlist_free(pol->active_circuit_pqueue);
+ pol->base_.magic = 0xDEAD901C;
tor_free(pol);
}
if (!pol_circ_data) return;
cdata = TO_EWMA_POL_CIRC_DATA(pol_circ_data);
-
+ cdata->base_.magic = 0xDEADC14C;
tor_free(cdata);
}