[tor-bugs] #13192 [Tor]: Collect aggregate stats of total hidden service usage vs total exit usage in Tor network

Tor Bug Tracker & Wiki blackhole at torproject.org
Fri Feb 13 17:57:43 UTC 2015


#13192: Collect aggregate stats of total hidden service usage vs total exit usage
in Tor network
-----------------------------+---------------------------------------
     Reporter:  arma         |      Owner:
         Type:  enhancement  |     Status:  needs_review
     Priority:  normal       |  Milestone:  Tor: 0.2.???
    Component:  Tor          |    Version:
   Resolution:               |   Keywords:  SponsorR tor-relay tor-hs
Actual Points:               |  Parent ID:
       Points:               |
-----------------------------+---------------------------------------

Comment (by yawning):

 Replying to [comment:52 dgoulet]:
 > However there is an other problem. Consider this example,
 https://people.torproject.org/~dgoulet/volatile/float.c, please run it and
 you'll see that even with a double well in between `[INT64_MIN,
 INT64_MAX]` when cast to int64_t weird things happen. In this case here,
 we always underflow even though the value is supposed to be valid which
 will make `sample_laplace_distribution` return wrong values because of the
 cast. (llround or/and trunc don't matter here, see example).
 >
 > Yawning is playing with this as we speak to understand it...

 Sigh.  Ok.  You're triggering undefined behavior, because of floating
 point happy fun times.  To be specific, you get 52 explicit bits of
 mantissa, so you will see rounding effects.  The double value of "d" in
 this case is INT64_MAX + 1 (2^(-1 * 0)^ * 1.0 * 2^(0x43e - 1023)^), which
 isn't representable.

 This shows one way to do this correctly:
 https://stackoverflow.com/questions/25857843/how-do-i-convert-an-
 arbitrary-double-to-an-integer-while-avoiding-undefined-beha

 Integers stored as IEEE doubles are only precise between -2^53^ to +2^53^
 due to the number of bits in the mantissa.  Past that, you are in for
 "fun", like what happened here.

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


More information about the tor-bugs mailing list