Page MenuHomePhabricator

[ASAN] Make sure we are only processing lifetime markers with offset 0 to alloca

Authored by lxfind on Oct 10 2020, 9:15 AM.



This patch addresses (and hence as well).
In latter instrumentation code, we always use the beginning of the alloca as the base for instrumentation, ignoring any offset into the alloca.
Because of that, we should only instrument a lifetime marker if it's actually pointing to the beginning of the alloca.

Diff Detail

Event Timeline

lxfind created this revision.Oct 10 2020, 9:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 10 2020, 9:15 AM
lxfind requested review of this revision.Oct 10 2020, 9:15 AM
vitalybuka accepted this revision.Oct 12 2020, 3:16 AM
vitalybuka added inline comments.

Similar problem is if the size of lifetime is smaller then alloca.
Would you like to handle that case, here or in the another patch?


Would you like to try to use llvm/utils/

This revision is now accepted and ready to land.Oct 12 2020, 3:16 AM
lxfind added inline comments.Oct 12 2020, 9:51 AM

Is that a problem though? A lifetime marker should always be accurate, that is, if the marker indicates that only part of the region is alive, it should be ok to just mark that region alive?

lxfind added inline comments.Oct 13 2020, 10:20 AM

I will land this as it is for now. But please do let me know your thoughts on what we want to do when the size doesn't match.

This revision was landed with ongoing or failed builds.Oct 13 2020, 10:22 AM
This revision was automatically updated to reflect the committed changes.
vitalybuka added inline comments.Oct 13 2020, 11:01 PM

if marker can point with offset, skipping the beginning of the alloca, then I assume sooner or later something may generate code which will set size smaller then alloca, skipping the tail of it.

vitalybuka added inline comments.Oct 13 2020, 11:16 PM
lxfind added inline comments.Oct 13 2020, 11:18 PM

Not sure if I follow, but my point is if the lifetime points to the beginning of the alloca, the generated instrumentation code will always be correct, and hence it's fine even the size may be smaller than the alloca size.