Skip to content
Snippets Groups Projects
Forked from The Tor Project / Core / Tor
Source project has a limited visibility.
  • David Goulet's avatar
    bbe90e3e
    hs-v2: Always check rend_cache validity before using it · bbe90e3e
    David Goulet authored
    
    When looking up an entry in the rend_cache, stop asserting that it exists but
    rather confirm it exists and if not, return that no entry was found.
    
    The reason for that is because the hs_circ_cleanup_on_free() function (which
    can end up looking at the rend_cache) can be called from the
    circuit_free_all() function that is called _after_ the rend cache is cleaned
    up in tor_free_all().
    
    We could fix the free all ordering but then it will just hide a future bug.
    Instead, handle a missing rend_cache as a valid use case as in while we are in
    the cleanup process.
    
    As Tor becomes more modular, it is getting more and more difficult to ensure
    subsystem callstack ordering thus this fix aims at making the HSv2 subsystem
    more robust at being called while tor is pretty much in any kind of state.
    
    Fixes #32847.
    
    Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>
    bbe90e3e
    History
    hs-v2: Always check rend_cache validity before using it
    David Goulet authored
    
    When looking up an entry in the rend_cache, stop asserting that it exists but
    rather confirm it exists and if not, return that no entry was found.
    
    The reason for that is because the hs_circ_cleanup_on_free() function (which
    can end up looking at the rend_cache) can be called from the
    circuit_free_all() function that is called _after_ the rend cache is cleaned
    up in tor_free_all().
    
    We could fix the free all ordering but then it will just hide a future bug.
    Instead, handle a missing rend_cache as a valid use case as in while we are in
    the cleanup process.
    
    As Tor becomes more modular, it is getting more and more difficult to ensure
    subsystem callstack ordering thus this fix aims at making the HSv2 subsystem
    more robust at being called while tor is pretty much in any kind of state.
    
    Fixes #32847.
    
    Signed-off-by: David Goulet's avatarDavid Goulet <dgoulet@torproject.org>