This is an archive of the discontinued LLVM Phabricator instance.

[asan-assembly-instrumentation] Added instrumentation for REP MOVS.
ClosedPublic

Authored by ygorshenin on Jul 30 2014, 2:49 AM.

Details

Reviewers
eugenis
Summary

[asan-assembly-instrumentation] Added instrumentation for REP MOVS.

Diff Detail

Event Timeline

ygorshenin updated this revision to Diff 12012.Jul 30 2014, 2:49 AM
ygorshenin retitled this revision from to [asan-assembly-instrumentation] Added instrumentation for REP MOVS..
ygorshenin updated this object.
ygorshenin edited the test plan for this revision. (Show Details)
ygorshenin added a reviewer: eugenis.
ygorshenin added a subscriber: Unknown Object (MLST).
eugenis added inline comments.Jul 30 2014, 4:34 AM
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
54

InstrumentMOVS has a return value that you probably want to check here for early exit.

181

In memcpy() we check shadow for entire source and destination ranges. I guess it's not easy to do efficiently in asm, but at least leave a FIXME.

Also, this code does push eax/ecx/edx/flags four times - once for each InstrumentMemOperand. Factor prologue/epilogue generation out of InstrumentMemOperand?

lib/Target/X86/AsmParser/X86AsmParser.cpp
2287

This looks too complex, with some of the original instructions emitted directly in AsmParser, and some (REP) in instrumentation code. Could we always emit original instruction (as needed) in InstrumentInstruction?

test/Instrumentation/AddressSanitizer/X86/asm_rep_movs.ll
72

get rid of this metadata if it's not used in the test

PTAL

lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
54

I'd prefer to get rid of return values for Instrument*() methods, as they're complicate the logic.

181

I've added FIXME comments for both issues. Would you mind if I'll resolve second issue in a next CL?

lib/Target/X86/AsmParser/X86AsmParser.cpp
2287

Done.

test/Instrumentation/AddressSanitizer/X86/asm_rep_movs.ll
72

Done.

eugenis added inline comments.Jul 30 2014, 7:15 AM
lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
176

Don't really need a return here.

181

OK

614–621

Don't you need to emit the original instruction here?

PTAL

lib/Target/X86/AsmParser/X86AsmInstrumentation.cpp
176

Done.

614–621

Yes, I need. Fixed + fixed test.

eugenis accepted this revision.Jul 31 2014, 2:19 AM
eugenis edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 31 2014, 2:19 AM
eugenis closed this revision.Jul 31 2014, 2:20 AM

r214395.