[tor-bugs] #15436 [Tor]: Unaligned access in SipHash24 code

Tor Bug Tracker & Wiki blackhole at torproject.org
Sun Mar 22 22:36:18 UTC 2015


#15436: Unaligned access in SipHash24 code
-------------------------+--------------------------------
     Reporter:  pstumpf  |      Owner:
         Type:  defect   |     Status:  needs_review
     Priority:  normal   |  Milestone:  Tor: 0.2.6.x-final
    Component:  Tor      |    Version:  Tor: 0.2.5.11
   Resolution:           |   Keywords:
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+--------------------------------
Changes (by yawning):

 * status:  new => needs_review


Comment:

 Replying to [ticket:15436 pstumpf]:
 > As you can easily see, node_get_mutable_by_id passes an unaligned
 pointer to siphash24, which memcpy then tries to copy from.  This is a
 (struct node_t)->identity, so maybe that struct should have alignment
 padding?

 No, that's not the problem.  The problem is `const uint64_t *in =
 (uint64_t*)src;`.  The compiler is allowed to (and in your case) does
 assume that in is aligned properly.

 Please let me know if this branch fixes this issue:
 https://github.com/Yawning/tor/compare/bug15436

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


More information about the tor-bugs mailing list