<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58706>58706</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Asan with clang reports puzzling "((ptr[0] == kCurrentStackFrameMagic) ) != (0)" while gcc doesn't
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ByteYue
</td>
</tr>
</table>
<pre>
Recently we encountered a puzzling asan report when compiling using `Ubuntu clang version 13.0.1-++20220120110844+75e33f71c2da-1~exp1~20220120230854.66`. Messages asan reports are as follows.
```
AddressSanitizer: CHECK failed: asan_thread.cpp:371 "((ptr[0] == kCurrentStackFrameMagic)) != (0)" (0x0, 0x0) (tid=68081)
#0 0x8ac92e1 in __asan::CheckUnwind() crtstuff.c
#1 0x8ade724 in __sanitizer::CheckFailed(char const*, int, char const*, unsigned long long, unsigned long long) crtstuff.c
#2 0x8acc95a in __asan::AsanThread::GetStackFrameAccessByAddr(unsigned long, __asan::AsanThread::StackFrameAccess*) crtstuff.c
#3 0x8a4e563 in __asan::AddressDescription::AddressDescription(unsigned long, unsigned long, bool) crtstuff.c
#4 0x8a50072 in __asan::ErrorGeneric::ErrorGeneric(unsigned int, unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long) crtstuff.c
#5 0x8ac7257 in __asan::ReportGenericError(unsigned long, unsigned long, unsigned long, unsigned long, bool, unsigned long, unsigned int, bool) crtstuff.c
#6 0x8a653c1 in vsprintf (/mnt/disk1/yuejing/projects/doris/output/be/lib/doris_be+0x8a653c1)
#7 0x8a66459 in __sprintf_chk (/mnt/disk1/yuejing/projects/doris/output/be/lib/doris_be+0x8a66459)
#8 0x1730ee29 in apache::thrift::transport::TSocket::local_open() (../output/be/lib/doris_be+0x1730ee29)
#9 0xb818303 in doris::ThriftClientImpl::open() ../be/src/util/thrift_client.cpp:30:25
......
```
After a series of debugging, we still hadn't discovered the underlying problem. Then we tried to compile the program using g++ with asan and started the program exactly the way we did before, and it turned out that the failed check had never happened anymore. It seems so weird that the asan program reacts inconsistently.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy1Vk1z2ywQ_jXyhYkGIevDBx8cO2477_TSpIeePAitJGpZaADFcX79uyC5dZ2kzXSmGkbAsuw--wFLocrT8gsI6Gx7Ikcg0Ak1dBY0lISTfnh-bmVXE254RzT0SltybKAjQh166ZcG4_5BSr8WuHEgouU4fwRtpOpIFIc0jG4CdouNUcZohC2i-XyOhCyBOK6ySLCS30RBdgdPvevOjCymeTIP0xTFh-QzGMNrMJdocKIBCaRSbauOJgzoJqAr5J-an67KUuPme95JK59BB_GKrD_erf8jFZctlG7uhO5so4GXoeh7JMVZRALGApZj660OklsaJBsSxBtsZL8etEbH3Vsu9lvND_CZ11IEbIENN0aOCXdST2F--ISTNfGdY8mtRN2bNKd55Lg8WIJfgJYjW87FgkFEZEd2OwcQUWFbNyD2X7uj7EoPbkEEesIOVRWKX2REXkYJGZuPMsyFB86CtqMLWC4arjGwnbEBWzmcsrOue0EfOiPrDjOkVRhq93uL-iYyNlonFgm_tm6Fowcfh3H-AS5cvBICA3l7chFFyL_odCB-J-hairfmTYSxRziHJI1fIBzTaQNGaNlbzPM36a9AfEEolGp_A2TugSSUZuwayJ3WSn-ADjTm3UvKhfIplH8G8164LxbexJ-Moc5Ykl3j_-LP8ATXQ3-Xw_4a4wVhcsgffJ967GkSC38IH02vcWNF_LHbHpyMbSnNHk_v9jTAd-m0bHutvoOwxi0qLV2vBtsPjrsA_LWyOK_tHOH2h5brWyAbAaTzZDGd4BHBTjT7f4PCqbpGkSOKKIspAPMweM9FA2MM8cqUlZ3GmnfGhXScPtwrsYdp0irB253qoZvuLOzC8D2gzpqvUS0QVZFHeUz9CR2NHBV7TOtW4vX86dC3I_VCt1fs9RmN52Q7WIlpsB1t2Qm_8VwFKP5YMmoO_fd6jamwamLNNJjLWKNURUo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