This is an archive of the discontinued LLVM Phabricator instance.

[ASAN] Fix detection of stack-use-after scope for char arrays.
ClosedPublic

Authored by vitalybuka on Jul 21 2016, 4:23 PM.

Details

Summary

Clang inserts GetElementPtrInst so findAllocaForValue was not
able to find allocas.

PR27453

Diff Detail

Event Timeline

vitalybuka updated this revision to Diff 64989.Jul 21 2016, 4:23 PM
vitalybuka retitled this revision from to Fix detection of stack-use-after scope for char arrays..
vitalybuka updated this object.
vitalybuka added reviewers: kcc, eugenis.
vitalybuka retitled this revision from Fix detection of stack-use-after scope for char arrays. to [ASAN] Fix detection of stack-use-after scope for char arrays..Jul 21 2016, 4:27 PM
eugenis edited edge metadata.Jul 21 2016, 4:30 PM

This needs an IR-level test that shows that proper instrumentation appears on lifetime-after-gep allocas.

vitalybuka updated this revision to Diff 65001.Jul 21 2016, 5:21 PM
vitalybuka edited edge metadata.

ll test

This needs an IR-level test that shows that proper instrumentation appears on lifetime-after-gep allocas.

Done.

eugenis added inline comments.Jul 21 2016, 5:26 PM
lib/Transforms/Instrumentation/AddressSanitizer.cpp
2294

We definitely should not crash if we see something we don't understand.
A dbg() message at most.

vitalybuka updated this revision to Diff 65002.Jul 21 2016, 5:37 PM

removed assert

eugenis accepted this revision.Jul 21 2016, 5:43 PM
eugenis edited edge metadata.

LGTM

lib/Transforms/Instrumentation/AddressSanitizer.cpp
2292

The message should probably say something about alloca or lifetime.

This revision is now accepted and ready to land.Jul 21 2016, 5:43 PM
vitalybuka updated this revision to Diff 65005.Jul 21 2016, 6:02 PM
vitalybuka marked an inline comment as done.
vitalybuka edited edge metadata.

updated message

This revision was automatically updated to reflect the committed changes.
vitalybuka marked an inline comment as done.