Loading changes/ticket33290 0 → 100644 +4 −0 Original line number Diff line number Diff line 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. src/core/or/circuitmux.c +6 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ #include "core/or/or_circuit_st.h" #include "lib/crypt_ops/crypto_util.h" /* * Private typedefs for circuitmux.c */ Loading Loading @@ -921,7 +923,10 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ)) /* 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); } } Loading Loading @@ -1282,4 +1287,3 @@ circuitmux_compare_muxes, (circuitmux_t *cmux_1, circuitmux_t *cmux_2)) return 0; } } src/core/or/circuitmux_ewma.c +3 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "core/or/circuitmux.h" #include "core/or/circuitmux_ewma.h" #include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_util.h" #include "feature/nodelist/networkstatus.h" #include "app/config/or_options_st.h" Loading Loading @@ -186,6 +187,7 @@ ewma_free_cmux_data(circuitmux_t *cmux, pol = TO_EWMA_POL_DATA(pol_data); smartlist_free(pol->active_circuit_pqueue); memwipe(pol, 0xda, sizeof(ewma_policy_data_t)); tor_free(pol); } Loading Loading @@ -252,7 +254,7 @@ ewma_free_circ_data(circuitmux_t *cmux, if (!pol_circ_data) return; cdata = TO_EWMA_POL_CIRC_DATA(pol_circ_data); memwipe(cdata, 0xdc, sizeof(ewma_policy_circ_data_t)); tor_free(cdata); } Loading src/core/or/circuitmux_ewma.h +6 −3 Original line number Diff line number Diff line Loading @@ -106,7 +106,9 @@ TO_EWMA_POL_DATA(circuitmux_policy_data_t *pol) { 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); } } Loading @@ -121,7 +123,9 @@ TO_EWMA_POL_CIRC_DATA(circuitmux_policy_circ_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); } } Loading @@ -132,4 +136,3 @@ STATIC void cell_ewma_initialize_ticks(void); #endif /* defined(CIRCUITMUX_EWMA_PRIVATE) */ #endif /* !defined(TOR_CIRCUITMUX_EWMA_H) */ Loading
changes/ticket33290 0 → 100644 +4 −0 Original line number Diff line number Diff line 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.
src/core/or/circuitmux.c +6 −2 Original line number Diff line number Diff line Loading @@ -79,6 +79,8 @@ #include "core/or/or_circuit_st.h" #include "lib/crypt_ops/crypto_util.h" /* * Private typedefs for circuitmux.c */ Loading Loading @@ -921,7 +923,10 @@ circuitmux_detach_circuit,(circuitmux_t *cmux, circuit_t *circ)) /* 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); } } Loading Loading @@ -1282,4 +1287,3 @@ circuitmux_compare_muxes, (circuitmux_t *cmux_1, circuitmux_t *cmux_2)) return 0; } }
src/core/or/circuitmux_ewma.c +3 −1 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #include "core/or/circuitmux.h" #include "core/or/circuitmux_ewma.h" #include "lib/crypt_ops/crypto_rand.h" #include "lib/crypt_ops/crypto_util.h" #include "feature/nodelist/networkstatus.h" #include "app/config/or_options_st.h" Loading Loading @@ -186,6 +187,7 @@ ewma_free_cmux_data(circuitmux_t *cmux, pol = TO_EWMA_POL_DATA(pol_data); smartlist_free(pol->active_circuit_pqueue); memwipe(pol, 0xda, sizeof(ewma_policy_data_t)); tor_free(pol); } Loading Loading @@ -252,7 +254,7 @@ ewma_free_circ_data(circuitmux_t *cmux, if (!pol_circ_data) return; cdata = TO_EWMA_POL_CIRC_DATA(pol_circ_data); memwipe(cdata, 0xdc, sizeof(ewma_policy_circ_data_t)); tor_free(cdata); } Loading
src/core/or/circuitmux_ewma.h +6 −3 Original line number Diff line number Diff line Loading @@ -106,7 +106,9 @@ TO_EWMA_POL_DATA(circuitmux_policy_data_t *pol) { 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); } } Loading @@ -121,7 +123,9 @@ TO_EWMA_POL_CIRC_DATA(circuitmux_policy_circ_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); } } Loading @@ -132,4 +136,3 @@ STATIC void cell_ewma_initialize_ticks(void); #endif /* defined(CIRCUITMUX_EWMA_PRIVATE) */ #endif /* !defined(TOR_CIRCUITMUX_EWMA_H) */