[tor-bugs] #27272 [- Select a component]: ASan is incompatible with Rust's jemalloc on Travis

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Aug 22 18:54:36 UTC 2018


#27272: ASan is incompatible with Rust's jemalloc on Travis
--------------------------------------+--------------------
     Reporter:  alexcrichton          |      Owner:  (none)
         Type:  defect                |     Status:  new
     Priority:  Medium                |  Milestone:
    Component:  - Select a component  |    Version:
     Severity:  Normal                |   Keywords:
Actual Points:                        |  Parent ID:
       Points:                        |   Reviewer:
      Sponsor:                        |
--------------------------------------+--------------------
 In helping to debug https://trac.torproject.org/projects/tor/ticket/25386
 I've found that many of the segfaults at runtime are attributable to Rust
 pulling in jemalloc by default for tests, which apparently doesn't play
 well with ASan when linked in.

 I've found that using code like:

 {{{
 #[global_allocator]
 static ALLOCATOR: std::alloc::System = std::alloc::System;
 }}}

 is enough to solve the problem. This tells Rust that it should use the
 system allocator (e.g. the malloc/free symbols) instead of jemalloc. This
 was stabilized very recently in Rust, though, so using it may not be so
 trivial!

 In some local testing I was able to get away with adding the above
 declaration to the `tor_allocate` crate for the most part, but crates like
 `crypto`, `external`, and `smartlist` don't already link to `tor_allocate`
 and needed the above declaration with a `#[cfg(test)]` as well. Once this
 was all added though I mostly no longer saw segfaults related to jemalloc
 and ASan

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


More information about the tor-bugs mailing list