Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Create a new issue
  • Issue Boards

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #27272

Closed (moved)
Open
Opened Aug 22, 2018 by Trac@tracbot

ASan is incompatible with Rust's jemalloc on Travis

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

Trac:
Username: alexcrichton

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Tor: 0.3.5.x-final
Milestone
Tor: 0.3.5.x-final
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#27272