This is an archive of the discontinued LLVM Phabricator instance.

[asan] Do not instrument pointers with address space attributes
ClosedPublic

Authored by zaks.anna on Jun 10 2016, 6:35 PM.

Details

Summary

Do not instrument pointers with address space attributes since we cannot track them anyway. Instrumenting them results in false positives in ASan and a compiler crash in TSan. (The compiler should not crash in any case, but that's a different problem.)

Diff Detail

Event Timeline

zaks.anna updated this revision to Diff 60432.Jun 10 2016, 6:35 PM
zaks.anna retitled this revision from to [asan] Do not instrument pointers with address space attributes.
zaks.anna updated this object.
zaks.anna added reviewers: kcc, aizatsky, kubamracek.
zaks.anna added a subscriber: llvm-commits.
kubamracek added a project: Restricted Project.
kubamracek accepted this revision.Jun 13 2016, 2:01 AM
kubamracek edited edge metadata.

LGTM with two nits.

lib/Transforms/Instrumentation/AddressSanitizer.cpp
953

Are we sure the cast is *always* valid? Maybe a dyn_cast + if would be better, but it’s up to you.

test/Instrumentation/ThreadSanitizer/tsan_address_space_attr.ll
32

Can we check for the presence of the instrumentation call instead? The presence or non-presence of “addrspacecast” is a secondary thing.

This revision is now accepted and ready to land.Jun 13 2016, 2:02 AM
kubamracek added inline comments.Jun 13 2016, 2:03 AM
test/Instrumentation/ThreadSanitizer/tsan_address_space_attr.ll
32

(or CHECK-NOT for both if the previous code inserted an invalid addrspacecast)

dvyukov accepted this revision.Jun 13 2016, 2:06 AM
dvyukov edited edge metadata.
zaks.anna added inline comments.Jun 13 2016, 10:13 AM
lib/Transforms/Instrumentation/AddressSanitizer.cpp
953

I'll double check again, but I think we do always get PointerType here.

test/Instrumentation/ThreadSanitizer/tsan_address_space_attr.ll
32

Can you clarify what you want to test for?

Codegen crashes on the addrspacecast instruction. I can also test that the load is not instrumented with an additional check.

kubamracek added inline comments.Jun 13 2016, 12:15 PM
test/Instrumentation/ThreadSanitizer/tsan_address_space_attr.ll
32

I can also test that the load is not instrumented with an additional check.

Yes please, that’s exactly what I meant.

zaks.anna closed this revision.Jul 29 2016, 5:36 PM

Closed by r273339.