I ran the sanitizer on 3 of my projects and I was surprised that all 3 had leaks or data race from dependencies and that unsafe
was used that much. I know Rust isn't perfect but I wasn't expecting that.
It appears to hate zero sized types
Yeah, we reached that conclusion too in rust-lang/rust#39882.
specifically if they're the last field on a struct it seems
These do produce loads of the ZST in the LLVM IR (I don't why that's the case but those loads translate to nothing in machine code) and that trips ASan. @eddyb mentioned that it may be possible to remove those loads though.
Have you checked that those are not false positives (re-running your test using Xargo may help). TSan, at least, appears to have a false positive around code that uses fences. I don't know of any false positive on LSan.
Cool, I might have to look into getting powerpc64 working at some point then
@japaric Is there an issue I can subscribe to for that? I would love to run Diesel through ASAN when it's possible (but not enough for me to go add a byte to every ZST behind a feature flag)
Another important thing is that violations often comes from FFI, so let's also add this:
CFLAGS=-fsanitize=address CXXFLAGS=-fsanitize=address
Assuming you have a decent C compiler, this will also make your libraries compiled in the build process safer!