aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-06-18 13:32:45 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-06-19 07:40:05 -0400
commite3f3478032921a8b6af07a655fd2ea520d3ff463 (patch)
tree1ce7e08945e290f53adbe722857324c699702023 /src/feature
parentb0fa1f4fb0b4f6a474b20e40e2810936c0577cc2 (diff)
downloadtor-e3f3478032921a8b6af07a655fd2ea520d3ff463.tar.gz
tor-e3f3478032921a8b6af07a655fd2ea520d3ff463.zip
guard: Ignore marked for close circuit when changing state to open
When we consider all circuits in "waiting for guard" state to be promoted to an "open" state, we were considering all circuits, even the one marked for close. This ultiamtely triggers a "circuit_has_opened()" called on the circuit that is marked for close which then leads to possible undesirable behaviors within a subsystem. For instance, the HS subsystem would be unable to find the authentication key of the introduction point circuit leading to a BUG() warning and a duplicate mark for close on the circuit. This commit also adds a unit test to make sure we never select marked for close circuits when upgrading its guard state from waiting for guard to open. Fixes #30871 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/client/entrynodes.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/feature/client/entrynodes.c b/src/feature/client/entrynodes.c
index e543289ce0..d191f58367 100644
--- a/src/feature/client/entrynodes.c
+++ b/src/feature/client/entrynodes.c
@@ -2611,6 +2611,10 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
entry_guard_t *guard = entry_guard_handle_get(state->guard);
if (!guard || guard->in_selection != gs)
continue;
+ if (TO_CIRCUIT(circ)->marked_for_close) {
+ /* Don't consider any marked for close circuits. */
+ continue;
+ }
smartlist_add(all_circuits, circ);
} SMARTLIST_FOREACH_END(circ);