<div dir="ltr"><div>Probably sched_yield() clobbered x13. Can you disassemble your glibc version?<br></div><div><br></div><div>Can you try change the test to</div><div>asm("mov x13, %0\n"<br>      "mov x14, %0\n"<br>      "mov x15, %0"<br>      :<br>      : "r"(p));<br></div><div><br></div><div>It should be fine to store value in additional registers just in case.</div><div><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 13 May 2021 at 11:45, Adhemerval Zanella via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all, <br>
<br>
I am investigating an intermittent failure on aarch64 linux bots related to<br>
asan, where the use_registers.cpp sometimes fails.  I tried to check if it<br>
some related issue on the test itself, but it does seems to do what the<br>
code is trying to simulate (an thread with store the address of a leaked<br>
allocation on the stack thread).<br>
<br>
Instrumenting the code to dump some log (log_pointers=1:log_threads=1) the<br>
following below (I omitted my local paths).  It seems that on some runs<br>
'use_registers=1' is really working as intended.<br>
<br>
Any idea? It started to show when we moved ours buildbots to newer ubuntu<br>
20.04 (with has a recent glibc 2.31), but I am not sure it is a glibc<br>
related issue.<br>
<br>
---<br>
<br>
FAIL: LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp (289 of 80810)<br>
******************** TEST 'LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp' FAILED ********************<br>
Script:<br>
--<br>
: 'RUN: at line 2';   LSAN_BASE="report_objects=1:use_stacks=0:log_pointers=1:log_threads=1"<br>
: 'RUN: at line 3';      <build_path>/bin/clang  --driver-mode=g++ -O0     -gline-tables-only -fsanitize=leak -I<src_path>/compiler-rt/test/lsan/../ -pthread <src_path>/compiler-rt/test/lsan/TestCases/use_registers.cpp -o <build_path>/projects/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp<br>
: 'RUN: at line 4';   env LSAN_OPTIONS=:detect_leaks=1:$LSAN_BASE:"use_registers=0" not  <build_path>/projects/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1 | FileCheck <src_path>/compiler-rt/test/lsan/TestCases/use_registers.cpp<br>
: 'RUN: at line 5';   env LSAN_OPTIONS=:detect_leaks=1:$LSAN_BASE:"use_registers=1"  <build_path>/projects/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1<br>
: 'RUN: at line 6';   env LSAN_OPTIONS=:detect_leaks=1:""  <build_path>/projects/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1<br>
--<br>
Exit Code: 23<br>
<br>
Command Output (stdout):<br>
--<br>
Test alloc: 0xffff7d503600 <br>
==342105==Ignored: chunk 0xffff7db03e80-0xffff7db03fb0 of size 304.<br>
==342105==Scanning GLOBAL range 0x0000004516f0-0x000000d25e80.<br>
==342105==Scanning GLOBAL range 0x000000da6f00-0x000000da90d8.<br>
==342105==Scanning GLOBAL range 0xffff7fe507d8-0xffff7fe606b0.<br>
==342105==0xffff7fe5d3e8: found 0xffff7e500000 pointing into chunk 0xffff7e500000-0xffff7e511c00 of size 72704.<br>
==342105==Scanning GLOBAL range 0xffff7fc7cd58-0xffff7fc7d078.<br>
==342105==Scanning GLOBAL range 0xffff7fbcbbf8-0xffff7fbd03e8.<br>
==342105==Scanning GLOBAL range 0xffff7fb9fd60-0xffff7fba0330.<br>
==342105==Scanning GLOBAL range 0xffff7fb87d48-0xffff7fb88100.<br>
==342105==Scanning GLOBAL range 0xffff7fb73db8-0xffff7fb74458.<br>
==342105==Scanning GLOBAL range 0xffff7fb478b8-0xffff7fb4fc50.<br>
==342105==Scanning GLOBAL range 0xffff7fe92590-0xffff7fe94200.<br>
==342105==Processing thread 342082.<br>
==342105==Scanning REGISTERS range 0xffff7f875000-0xffff7f875110.<br>
==342105==TLS at 0xffff7f9cd030-0xffff7f9db6b0.<br>
==342105==Scanning TLS range 0xffff7f9cd030-0xffff7f9cd760.<br>
==342105==Scanning TLS range 0xffff7f9daf80-0xffff7f9db6b0.<br>
==342105==Processing thread 342099.<br>
==342105==Scanning REGISTERS range 0xffff7f875000-0xffff7f875110.<br>
==342105==TLS at 0xffff7e4f1980-0xffff7e500000.<br>
==342105==Scanning TLS range 0xffff7e4f1980-0xffff7e4f20b0.<br>
==342105==Scanning TLS range 0xffff7e4ff8d0-0xffff7e500000.<br>
==342105==Scanning HEAP range 0xffff7e500000-0xffff7e511c00.<br>
==342105==Scanning HEAP range 0xffff7db03e80-0xffff7db03fb0.<br>
==342105==Processing platform-specific allocations.<br>
==342105==Scanning leaked chunks.<br>
==342105==Scanning HEAP range 0xffff7d503600-0xffff7d503b39.<br>
==342105==Scanning HEAP range 0xffff7db03e80-0xffff7db03fb0.<br>
<br>
=================================================================<br>
==342082==ERROR: LeakSanitizer: detected memory leaks<br>
<br>
Direct leak of 1337 byte(s) in 1 object(s) allocated from:<br>
    #0 0x42bc20 in malloc <src_path>/compiler-rt/lib/lsan/lsan_interceptors.cpp:56:3<br>
    #1 0x42dbf8 in registers_thread_func <src_path>/compiler-rt/test/lsan/TestCases/use_registers.cpp:17:13<br>
    #2 0xffff7fba94f8 in start_thread /build/glibc-iW00TY/glibc-2.31/nptl/pthread_create.c:477:8<br>
    #3 0xffff7fab1678  /build/glibc-iW00TY/glibc-2.31/misc/../sysdeps/unix/sysv/linux/aarch64/clone.S:78<br>
<br>
Objects leaked above:<br>
0xffff7d503600 (1337 bytes)<br>
<br>
SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s).<br>
<br>
--<br>
<br>
********************<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>