This is an archive of the discontinued LLVM Phabricator instance.

[MSAN] Avoid dangling ActualFnStart when replacing instruction
ClosedPublic

Authored by guiand on Aug 14 2020, 3:21 PM.

Details

Summary
This would be a problem if the entire instrumented function was a call to
e.g. memcpy

Diff Detail

Event Timeline

guiand created this revision.Aug 14 2020, 3:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2020, 3:21 PM

This adds future implementation complexity.

How about a different representation of ActualFnStart: the last instruction before the insertion point, or null if at the BB entry?

guiand updated this revision to Diff 285787.Aug 14 2020, 4:35 PM

Emit a nop instruction to always mark the end of the MSan prologue, and insert prologue instructions before that.

eugenis accepted this revision.Aug 14 2020, 4:39 PM

LGTM with a nit

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
1103

I don't think you need to update FnPrologueEnd anymore.

This revision is now accepted and ready to land.Aug 14 2020, 4:39 PM
guiand added inline comments.Aug 14 2020, 4:40 PM
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
1103

Good catch. Will remove that!

This revision was landed with ongoing or failed builds.Aug 14 2020, 4:51 PM
This revision was automatically updated to reflect the committed changes.