forked from OSchip/llvm-project
5f185a8999
Summary: In some cases, ASan may insert instrumentation before function arguments have been stored into their allocas. This causes two issues: 1) The argument value must be spilled until it can be stored into the reserved alloca, wasting a stack slot. 2) Until the store occurs in a later basic block, the debug location will point to the wrong frame offset, and backtraces will show an uninitialized value. The proposed solution is to move instructions which initialize allocas for arguments up into the entry block, before the position where ASan starts inserting its instrumentation. For the motivating test case, before the patch we see: ``` | 0033: movq %rdi, 0x68(%rbx) | | DW_TAG_formal_parameter | | ... | | DW_AT_name ("a") | | 00d1: movq 0x68(%rbx), %rsi | | DW_AT_location (RBX+0x90) | | 00d5: movq %rsi, 0x90(%rbx) | | ^ not correct ... | ``` and after the patch we see: ``` | 002f: movq %rdi, 0x70(%rbx) | | DW_TAG_formal_parameter | | | | DW_AT_name ("a") | | | | DW_AT_location (RBX+0x70) | ``` rdar://61122691 Reviewers: aprantl, eugenis Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77182 |
||
---|---|---|
.. | ||
AddressSanitizer | ||
BoundsChecking | ||
DataFlowSanitizer | ||
HWAddressSanitizer | ||
InstrOrderFile | ||
InstrProfiling | ||
MemorySanitizer | ||
PoisonChecking | ||
SanitizerCoverage | ||
ThreadSanitizer | ||
cgprofile.ll |