[tor-bugs] #29528 [Core Tor/Tor]: UndefinedBehaviorSanitizer errors should fail the unit tests

Tor Bug Tracker & Wiki blackhole at torproject.org
Tue May 21 12:35:13 UTC 2019


#29528: UndefinedBehaviorSanitizer errors should fail the unit tests
-------------------------------------------------+-------------------------
 Reporter:  teor                                 |          Owner:  (none)
     Type:  defect                               |         Status:
                                                 |  needs_revision
 Priority:  Medium                               |      Milestone:  Tor:
                                                 |  0.4.1.x-final
Component:  Core Tor/Tor                         |        Version:
 Severity:  Normal                               |     Resolution:
 Keywords:  tor-ci, tor-test, 041-proposed,      |  Actual Points:  0.2
  029-backport, 034-backport, 035-backport,      |
  040-backport, 041-should                       |
Parent ID:                                       |         Points:  2
 Reviewer:  nickm                                |        Sponsor:
-------------------------------------------------+-------------------------

Comment (by cypherpunks):

 > So the UBSan runtime reports divisions by zero, but the UBSan trap does
 not? That's also really weird.
 Clang has very poor documentation, but a lot of features come from GCC,
 and Clang's devs recommend to use GCC docs :( plus "read the source" :(
 So, here's where it comes from (GCC):
 "Unlike other similar options, -fsanitize=float-divide-by-zero is not
 enabled by -fsanitize=undefined, since floating-point division by zero can
 be a legitimate way of obtaining infinities and NaNs."
 And `trap` one has the same default behavior:
 "The -fsanitize-undefined-trap-on-error option instructs the compiler to
 report undefined behavior using `__builtin_trap` rather than a libubsan
 library routine. The advantage of this is that the libubsan library is not
 needed and is not linked in, so this is usable even in freestanding
 environments."
 > And makes it hard to work out which one we should use.
 Should? You should try to ship Tor with production-grade version of UBSan:
 https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#minimal-
 runtime

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


More information about the tor-bugs mailing list