[tor-bugs] #24914 [Core Tor/Tor]: Maybe make relay_digest_matches() not use tor_malloc()

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue Jan 16 19:03:37 UTC 2018


#24914: Maybe make relay_digest_matches() not use tor_malloc()
------------------------------+--------------------------------
     Reporter:  dgoulet       |      Owner:  (none)
         Type:  defect        |     Status:  new
     Priority:  Medium        |  Milestone:  Tor: 0.3.3.x-final
    Component:  Core Tor/Tor  |    Version:
     Severity:  Normal        |   Keywords:  tor-relay
Actual Points:                |  Parent ID:
       Points:                |   Reviewer:
      Sponsor:                |
------------------------------+--------------------------------
 The `relay_digest_matches()` is used in `relay_crypt()` and it is called
 for a huge portion of cells that come through the relay.

 Roughly speaking, if a relay is at 10MB/s and with cells of size 514
 bytes, we are talking about a bit less than 20k cells *per* second meaning
 more than a million `tor_malloc(20)` per minute. This is the place:

 {{{
   backup_digest = crypto_digest_dup(digest);
 }}}

 I think we should find a way to avoid this especially in the fast path of
 tor in order to avoid memory fragmentation as much as possible.

 We could either use the stack, a static value or `memarea` subsystem.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/24914>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list