Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate running tests under Address Sanitizer #749

Closed
jdm opened this issue Jul 27, 2011 · 15 comments
Closed

Investigate running tests under Address Sanitizer #749

jdm opened this issue Jul 27, 2011 · 15 comments
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@jdm
Copy link
Contributor

jdm commented Jul 27, 2011

http://code.google.com/p/address-sanitizer/wiki/AddressSanitizer

It finds use-after-free and out-of-bounds errors with very little overhead. Could be useful.

@sayrer
Copy link

sayrer commented Jul 27, 2011

On OS X, you can use libgmalloc. It isn't that slow.

@sayrer sayrer closed this as completed Jul 27, 2011
@sayrer sayrer reopened this Jul 27, 2011
@brson
Copy link
Contributor

brson commented Nov 3, 2012

I agree this looks really cool. Needs compiler support.

@graydon
Copy link
Contributor

graydon commented May 1, 2013

nominating for well covered

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

subset of valgrind, doesn't improve accuracy, de-milestoning

@graydon
Copy link
Contributor

graydon commented Jun 6, 2013

just a bug, removing milestone/nomination.

@bblum
Copy link
Contributor

bblum commented Aug 2, 2013

Ah, this is clever. They beat valgrind because they add instrumentation into the code while it's being compiled, rather than preloading stuff at runtime. For our purposes this is fine; since we have a dedicated set of valgrind bots, they can just do make ASAN=1 or whatever from the start.

(Triage visit in disguise.)

@bblum
Copy link
Contributor

bblum commented Aug 2, 2013

By the way, the paper is clearly-written and pretty approachable.

@huonw
Copy link
Member

huonw commented Jan 3, 2014

Triage: not done yet.

@vadimcn
Copy link
Contributor

vadimcn commented Jan 9, 2014

cc #8426

@emberian
Copy link
Member

emberian commented Feb 4, 2014

To compile with asan:

rustc --passes asan,asan-module --link-args "/usr/bin/../lib/clang/3.4/lib/linux/libclang_rt.asan-x86_64.a" foo.rs

@emberian
Copy link
Member

emberian commented Feb 4, 2014

@emberian
Copy link
Member

emberian commented Feb 4, 2014

If we start building the libclang_rt stuff, it'd be trivial to add a --sanitize option to rustc.

@vadimcn
Copy link
Contributor

vadimcn commented Feb 4, 2014

To catch bad memory accesses (e.g. use after free) Rust will need to start emitting sanitize_address attribute on all functions, though. Otherwise asan passes won't insert any instrumentation.

@emberian
Copy link
Member

emberian commented Feb 4, 2014

Ah good to know. That shouldn't be hard at all though.

On Tue, Feb 4, 2014 at 3:58 AM, Vadim Chugunov notifications@github.comwrote:

To catch bad memory accesses (e.g. use after free) Rust will need to start
emitting sanitize_address attribute on all functions, though. Otherwise
asan passes won't insert any instrumentation.


Reply to this email directly or view it on GitHubhttps://github.com//issues/749#issuecomment-34040924
.

@thestinger
Copy link
Contributor

This really needs to be refiled as "implement address sanitizer support" which is a huge project. It's not useful without frontend support, and IMO it's too much complexity to add to librustc in the current state it's in. Sanitizers would need to be added for all the unsafe intrinsics along with unsafe pointer dereferencing. It's not going to map well to the sanitizers used by Clang, since Rust does everything in the libraries with the basic compiler intrinsics. It doesn't have a language feature for unsafe indexing of arrays, etc.

keeperofdakeys pushed a commit to keeperofdakeys/rust that referenced this issue Dec 12, 2017
apple: Add VM_* constants from mach/vm_statistics.h

Closes rust-lang#736.
pdietl pushed a commit to pdietl/rust that referenced this issue Apr 23, 2020
fix `TypeParamBounds` link on trait objects
ZuseZ4 pushed a commit to EnzymeAD/rust that referenced this issue Mar 7, 2023
* Handle array types in TypeAnalysis

* Handle array calling convention of cabs

* Add tests
celinval pushed a commit to celinval/rust-dev that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

No branches or pull requests

9 participants