Closed Bug 1563019 Opened 6 years ago Closed 4 years ago

Enable ASan in Rust code

Categories

(Firefox Build System :: General, task, P3)

task

Tracking

(firefox86 fixed)

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: away, Assigned: away)

References

Details

(Keywords: in-triage)

Attachments

(1 file)

As far as I can tell, we don't currently sanitize Rust code in our ASan builds. Maybe we should, because of unsafe code.

Depends on: 1533213

Welp, attempting this on Windows didn't get very far:

error: AddressSanitizer only works with the `x86_64-unknown-linux-gnu` or `x86_64-apple-darwin` target

https://github.com/rust-lang/rust/blob/0beb2ba16a08dfa01569b5f4644da315dc4c806c/src/librustc_metadata/creader.rs#L784

Depends on: 1587774
Depends on: 1627768
Depends on: 1630351

This patch enables ASan for rust code in the linux64-asan/{debug,opt} build tasks. Since it is a -Z unstable flag, we'll move to the same linux64-rust-nightly toolchain that TSan builds use.

For the time being, the ASan Nightly Reporter builds are left alone, until we're more familiar with the perf impacts of this landing.

Assignee: nobody → dmajor
Status: NEW → ASSIGNED
Pushed by dmajor@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5feb91adec85 Enable ASan for rust code in linux64-asan builds r=decoder,mhentges
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch

I ran StyleBench, on the assumption that it should spend a relatively large amount of its time in Rust code.

linux64-opt: 69.3
linux64-asan (before -- C++ only): 23.2
linux64-asan (after -- C++ and Rust): 20.9

So there's some cost but not nearly as much as base ASan. What do you think?

Flags: needinfo?(choller)

For comparison here's Speedometer which is less sensitive to Rust:

linux64-opt: 69.7
linux64-asan (before -- C++ only): 26.5
linux64-asan (after -- C++ and Rust): 26.0

I think that's fine. I also checked for some Mochitests before and after your push and the funny thing is: All of the test chunks I checked are consistently faster with your push (by 2-3 minutes). So either your push unexpectedly improved performance or the test noise here is a lot larger than the perf impact. Maybe the switch to Rust nightly somehow overall caused a slight performance improvement that isn't visible in the StyleBench?

In any case, I think we're good here.

Flags: needinfo?(choller)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: