[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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



#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                |     Resolution:
 Keywords:                        |  Actual Points:
Parent ID:                        |         Points:
 Reviewer:                        |        Sponsor:
----------------------------------+------------------------

Comment (by alexcrichton):

 As a follow-up to this as well, I've found that one final reason (I hope!)
 as to why Travis is failing with hardened code and Rust is due to the
 usage of `link_rust.sh` in RUSTFLAGS. By default Tor is using `cargo test`
 without a `--target` argument which means that `RUSTFLAGS` is *also*
 passed to compilation of build scripts. These build scripts don't actually
 link to C code and don't need the `-fsanitize=address` treatment, but the
 build scripts (often in upstream crates) are compiled with Jemalloc as the
 crate's allocator. By being linked with `link_rust.sh` this causes them to
 segfault at runtime, presumably because ASan is not compatible with
 jemalloc.

 One way to fix this I know if (and yes, I know this is a weird fix!) is to
 pass `--target x86_64-unknown-linux-gnu`. Basically you pass `--target` to
 Cargo as-if you're cross-compiling, except you're not actually given the
 actual targets in play. This causes Cargo to not pass `RUSTFLAGS` to the
 build script compilations, meaning that build scripts are not compiled
 with sanitizers.

 This part is definitely the trickiest, and I haven't quite figured out yet
 how to integrate this into the build system :(

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/27272#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs