<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 20, 2016 at 6:47 PM, ZhaoKang <span dir="ltr"><<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">You mentioned that '<span style="line-height:16.8px">Some global settings in the system may for some reason reject such huge mappings.</span>'<div>And I want to know which kinds of settings may have this effect?</div></blockquote><div><br></div><div>Something related to memory overcommit. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>And did any other users encounter this kind of issue before?</div></blockquote><div><br></div><div>Not on Linux. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>And the output error message said that '<span style="font-family:calibri,sans-serif;line-height:16.8px">==41651==ERROR: AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at address 2008fff7000 (errno: 12)</span><span style="line-height:1.2">'</span></div><div><span style="line-height:1.2">Does this feature need allocate so large memory? </span></div></blockquote><div><br></div><div>Yes. </div><div>You may read <a href="https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm">https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm</a> for details. </div><div><br></div><div>My suggestion: build a single binary with asan and run it under strace on both systems that you have, </div><div>then compare the output. </div><div><br></div><div>Can you give me access to a machine where this fails? </div><div>Is this OS variant available on GCE (<a href="https://cloud.google.com/compute/">https://cloud.google.com/compute/</a>)? </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span style="line-height:1.2">or this feature dump the error message?</span></div><div><br></div><div>Thanks a lot!</div><div><br><br><blockquote name="replyContent" style="padding-left:5px;margin-left:5px;border-left:2px solid rgb(182,182,182);margin-right:0px">-----原始邮件-----<br>
<b>发件人:</b> "Kostya Serebryany" <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>><br>
<b>发送时间:</b> 2016-09-21 00:35:55 (星期三)<br>
<b>收件人:</b> ZhaoKang <<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a><wbr>><br>
<b>抄送:</b> "Clang Dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br>
<b>主题:</b> Re: Re: Re: [cfe-dev] Question about Clang/LLVM addresssanitizer<div><div class="gmail-h5"><br><br><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 19, 2016 at 9:41 PM, ZhaoKang <span dir="ltr"><<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a><wbr>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Yes, if just a small case like following also failed:<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">int
main() {<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">   
int *mem = new int[100];<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">   
for (unsigned i = 0; i<=100; i++ ) {<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">       
mem[i] = i;<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">   
}<u></u><u></u></span></p>

<p class="MsoNormal" style="text-indent:9.6pt"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">return 0;<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"courier new"">}<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">And I build like this:<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ clang++  -fsanitize=address -fsanitize=undefined main.cpp<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ ll -h a.out<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">-rwxr-x---
1 fangqing hd <span style="color:red">9.6M</span> Sep 19 21:24 a.out</span></p></blockquote><div><br></div><div>9.6M is a bit unusual, on my box I get a 2.4M binary, </div><div>but not entirely bad. asan links lots of stuff into a binary. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif"><u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ ASAN_OPTIONS=verbosity=1 ./a.out<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_printf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_sprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_snprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_fprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_vprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_vsprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_vsnprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept '__isoc99_vfprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept 'process_vm_readv'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
failed to intercept 'process_vm_writev'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==AddressSanitizer:
libc interceptors initialized<u></u><u></u></span></p><span class="gmail-m_-1092062880017286122gmail-">

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x10007fff8000, 0x7fffffffffff]` || HighMem    ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x005000000000, 0x02008fff6fff]` || ShadowGap3 ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x003000000000, 0x004fffffffff]` || MidMem     ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x000a7fff8000, 0x002fffffffff]` || ShadowGap2 ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x00067fff8000, 0x000a7fff7fff]` || MidShadow  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x00008fff7000, 0x00067fff7fff]` || ShadowGap  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x00007fff8000, 0x00008fff6fff]` || LowShadow  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">||
`[0x000000000000, 0x00007fff7fff]` || LowMem     ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">MemToShadow(shadow):
0x00008fff7000 0x000091ff6dff 0x004091ff6e00 0x02008fff6fff 0x00014fff7000
0x0001cfff6fff<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">redzone=16<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">max_redzone=2048<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">quarantine_size_mb=256M<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">malloc_context_size=30<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">SHADOW_SCALE:
3<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">SHADOW_GRANULARITY:
8<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">SHADOW_OFFSET:
0x7fff8000<u></u><u></u></span></p>

</span><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==ERROR:
AddressSanitizer failed to allocate 0xdfff0001000 (15392894357504) bytes at
address 2008fff7000 (errno: 12)<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">==41651==ReserveShadowMemoryRa<wbr>nge
failed while trying to map 0xdfff0001000 bytes. Perhaps you're using ulimit -v<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">Aborted
(core dumped)<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">If compile this small case without address-sanitizer, the
generated executable file is just</span><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:red"> 6.8K</span><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">, and
if with this feature, the executable file is </span><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:red">9.6M</span><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">.<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ clang++  main.cpp              
<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ ll -h a.out<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">-rwxr-x---
1 fangqing hd <span style="color:red">6.8K</span> Sep 19 21:28 a.out<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-family:calibri,sans-serif"><font color="#ff0000"><b><font size="4">And the most important is that if we move this case to another Linux
server, the address-sanitizer feature works fine.</font></b><span style="font-size:10.5pt"><u></u><u></u></span></font></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Now the failed case is built on following RedHat server:</span><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif;color:red"><u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ uname -a<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">Linux
xcoapps57 2.6.32-504.el6.x86_64 #1 SMP Tue Sep 16 01:56:35 EDT 2014 x86_64
x86_64 x86_64 GNU/Linux<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">fangqing@[xcoapps57
small_case]$ cat /etc/redhat-release<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">Red
Hat Enterprise Linux Workstation release 6.6 (Santiago)<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">So
is it related to different platform? And what does this feature depend on?</span></p></blockquote><div><br></div><div>asan depends on the ability to mmap a huge range of address space with MAP_NORESERVE. <br></div><div>Some global settings in the system may for some reason reject such huge mappings. </div><div>But I have not seen this before. </div><div><br></div><div>--kcc </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif"><u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif"> </span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:calibri,sans-serif">Thanks
a lot!<u></u><u></u></span></p><br><br><blockquote name="replyContent" style="padding-left:5px;margin-left:5px;border-left:2px solid rgb(182,182,182);margin-right:0px"><span class="gmail-m_-1092062880017286122gmail-">----------<br><b>From:</b> "Kostya Serebryany" <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>><br></span><b>Time:</b> 2016-09-20 10:36:16 (星期二)<br>
<b>To:</b> ZhaoKang <<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a><wbr>><br><b>cc:</b> "Clang Dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>Title:</b> Re: Re: [cfe-dev] Question about Clang/LLVM addresssanitizer<div><div class="gmail-m_-1092062880017286122gmail-h5"><br><br><div dir="ltr">Does this happen with any small application on your system, or only with this (presumably big) one? <div>You will need to figure out why the asan's mmap fails here. </div><div>Best is to run the process under strace and see <br></div><div>  * are there any mmaps that intersect with this one</div><div>  * are there any syscalls that limit the address space (setrlimit)</div><div><br></div><div>--kcc </div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 19, 2016 at 7:18 PM, ZhaoKang <span dir="ltr"><<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a><wbr>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Kostya,<div><br></div><div>Thanks a lot for your reply!</div><div>For the first question, we have dump out the info, please see the following:</div><div>==============================<wbr>===============</div><div><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">ASAN_OPTIONS=verbosity=1 ./csim.exe <u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept '__isoc99_printf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'__isoc99_sprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'__isoc99_snprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept '__isoc99_fprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'__isoc99_vprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'__isoc99_vsprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'__isoc99_vsnprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept '__isoc99_vfprintf'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'process_vm_readv'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: failed to intercept
'process_vm_writev'<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==AddressSanitizer: libc interceptors initialized<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x10007fff8000, 0x7fffffffffff]` || HighMem   
||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x02008fff7000, 0x10007fff7fff]` || HighShadow ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x005000000000, 0x02008fff6fff]` || ShadowGap3 ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x003000000000, 0x004fffffffff]` ||
MidMem     ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x000a7fff8000, 0x002fffffffff]` || ShadowGap2 ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x00067fff8000, 0x000a7fff7fff]` || MidShadow  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x00008fff7000, 0x00067fff7fff]` || ShadowGap  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x00007fff8000, 0x00008fff6fff]` || LowShadow  ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">|| `[0x000000000000, 0x00007fff7fff]` ||
LowMem     ||<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">MemToShadow(shadow): 0x00008fff7000 0x000091ff6dff
0x004091ff6e00 0x02008fff6fff 0x00014fff7000 0x0001cfff6fff<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">redzone=16<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">max_redzone=2048<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">quarantine_size_mb=256M<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">malloc_context_size=30<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">SHADOW_SCALE: 3<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">SHADOW_GRANULARITY: 8<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">SHADOW_OFFSET: 0x7fff8000<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==ERROR: AddressSanitizer failed to allocate
0xdfff0001000 (15392894357504) bytes at address 2008fff7000 (errno: 12)<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">==25048==ReserveShadowMemoryRa<wbr>nge failed while trying to map
0xdfff0001000 bytes. Perhaps you're using ulimit -v<u></u><u></u></span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Aborted (core dumped)</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)"> </span><span style="line-height:16.8px">=============================<wbr>================</span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Thanks!</span></p><p class="MsoNormal"><span lang="EN-US" style="font-size:11pt;font-family:calibri,sans-serif;color:rgb(31,73,125)">Kang</span></p><br><blockquote name="replyContent" style="padding-left:5px;margin-left:5px;border-left:2px solid rgb(182,182,182);margin-right:0px">----------<br><b>From:</b> "Kostya Serebryany" <<a href="mailto:kcc@google.com" target="_blank">kcc@google.com</a>><br>
<b>Time:</b> 2016-09-09 05:50:03<br><b>Time:</b> ZhaoKang <<a href="mailto:zhaokang@mail.tsinghua.edu.cn" target="_blank">zhaokang@mail.tsinghua.edu.cn</a><wbr>><br><b>CC:</b> "Clang Dev" <<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>><br><b>Subject:</b> Re: [cfe-dev] Question about Clang/LLVM addresssanitizer<div><div class="gmail-m_-1092062880017286122gmail-m_2318848000227310655h5"><br><br><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 8, 2016 at 1:09 AM, ZhaoKang via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">Hello,<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">We have one
question about the clang compiler option: -fsanitize=address. (We want to use
the feature to detect potential bug in out c++ design.)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">However, when
using clang to compile our two cases with this option, one case error out with
following message:<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">==31183==ERROR: AddressSanitizer <b><span style="color:red">failed to allocate 0x400000000</span></b> (17179869184) bytes
at address 67fff8000 (errno: 12)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">==31183==ReserveShadowMemoryRa<wbr>nge failed
while trying to map 0x400000000 bytes. Perhaps you're using ulimit </span><span lang="EN-US" style="font-family:"courier new"">–</span><span lang="EN-US">v</span></p></blockquote><div><br></div><div>This happens at startup right? </div><div>something causes asan to fail to allocate the shadow.</div><div><br></div><div>please send the output of </div><div>   ASAN_OPTIONS=verbosity=1 ./your-binary</div><div><br></div><div>or, better, send the reproducer. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"><u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">The other case
error out with following message:<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">==30711==ERROR: AddressSanitizer: <b><span style="color:red">stack-buffer-overflow</span></b> on address 0x7fff8a931dcd at
pc 0x000000861eec bp 0x7fff8a9303f0 sp 0x7fff8a9303e8</span></p></blockquote><div><br></div><div>that smells like a real bug in your code. </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"><u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">READ of size 1 at 0x7fff8a931dcd thread
T0<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    #0 0x861eeb in
ap_private<8, false, true>::RType<32, true>::mult ap_private<8,
false, true>::operator*<32, true>(ap_private<32, true,
(32)<=(64)> const&) const
(/wrk/xbj_vdi/fangqing/work/sp<wbr>rite/hls/BugSpray/crs/810730/h<wbr>scale/solution1/csim/build/csi<wbr>m.exe+0x861eeb)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    #1 0x7d717f in
ap_private<8, false, (8)<=(64)>::RType<32, true>::mult operator*<8,
false>(ap_private<8, false, (8)<=(64)> const&, int)
(/wrk/xbj_vdi/fangqing/work/sp<wbr>rite/hls/BugSpray/crs/810730/h<wbr>scale/solution1/csim/build/csi<wbr>m.exe+0x7d717f)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    </span><span lang="EN-US" style="font-family:"courier new"">…</span><span lang="EN-US"><u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    #6 0x3099a1d9c3 in
__libc_start_main (/lib64/libc.so.6+0x3099a1d9c3<wbr>)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    #7 0x4c3648 in _start
(/wrk/xbj_vdi/fangqing/work/sp<wbr>rite/hls/BugSpray/crs/810730/h<wbr>scale/solution1/csim/build/csi<wbr>m.exe+0x4c3648)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">Address 0x7fff8a931dcd is located in
stack of thread T0 at offset 1549 in frame<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">    #0 0x78628f in
hscale_core(hls::stream<HSC_MP<wbr>IX_STRUCT>&, ap_uint<4>,
ap_uint<16>, ap_uint<16>, ap_uint<16>, ap_uint<32>,
ap_uint<2>, ap_int<16> (*) [8],
hls::stream<HSC_MPIX_STRUCT>&)
(/wrk/xbj_vdi/fangqing/work/sp<wbr>rite/hls/BugSpray/crs/810730/h<wbr>scale/solution1/csim/build/csi<wbr>m.exe+0x78628f)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US">  This frame has 215 object(s):<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21.6pt"><span lang="EN-US">[32, 33)
'RegSmplsPerClk'<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21.6pt"><span lang="EN-US">[48, 49)
'RegBitsPerCol'<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21.6pt"><span lang="EN-US">[64, 66)
'TotalLines'<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21.6pt"><span lang="EN-US" style="font-family:"courier new"">…</span><span lang="EN-US"><u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:15.75pt"><span lang="EN-US">[1552, 1553)
'ref.tmp65' <== Memory access at offset 1549 underflows this variable<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21pt"><span lang="EN-US">[1568, 1569)
'ref.tmp68'<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21pt"><span lang="EN-US" style="font-family:"courier new"">…</span><span lang="EN-US"><u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText" style="text-indent:21pt"><span lang="EN-US"> </span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">Both of them can
be compiled successfully and run correctly when compiled with clang without
this addrsanitizer option. However both of them failed when add this option.<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">From the error
message we can see AddressSanitizer need to allocate a very large memory (about
16G byte) from heap memory pool (1<sup>st</sup> case), or occupy large stack
memory and cause stack-buffer-overflow (2<sup>nd</sup> case). (ulimit </span><span lang="EN-US" style="font-family:"courier new";color:rgb(47,85,151)">–</span><span lang="EN-US" style="color:rgb(47,85,151)">v shows unlimited)<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)">So our question is
it is this feature</span><span lang="EN-US" style="font-family:"courier new";color:rgb(47,85,151)">’</span><span lang="EN-US" style="color:rgb(47,85,151)">s shortcoming or
there is something wrong with our development environment?<u></u><u></u></span></p>

<p class="gmail-m_-1092062880017286122gmail-m_2318848000227310655m_-5230326661904914995m_3909676279768923390MsoPlainText"><span lang="EN-US" style="color:rgb(47,85,151)"> </span></p><br><br><br><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</div></div></blockquote></div><br><br><br></blockquote></div><br></div>
</div></div></blockquote><br><br><br></blockquote></div><br></div></div>
</div></div></blockquote></div><br><br><br></blockquote></div><br></div></div>