chestnykh wrote:

I've debugged msan errors. On CI there were stack overflows caused by 'wrong' 
msan reports and circular calls libunwind -> libmsan -> libunwind.

For example:
```
#4234 0x0000555555587eb2 in __msan_warning_with_origin_noreturn () at 
/home/dima/work/llvm-project/compiler-rt/lib/msan/msan.cpp:422
#4235 0x00007ffff7f7828e in libunwind::Registers_x86_64::getRegister 
(this=0x7fffffa07cc0, regNum=-1) at 
/home/dima/work/llvm-project/libunwind/src/Registers.hpp:412
#4236 0x00007ffff7f72b5c in 
libunwind::UnwindCursor<libunwind::LocalAddressSpace, 
libunwind::Registers_x86_64>::getReg (this=0x7fffffa07cb0, regNum=-1)
    at /home/dima/work/llvm-project/libunwind/src/UnwindCursor.hpp:1353
#4237 0x00007ffff7f741a3 in 
libunwind::UnwindCursor<libunwind::LocalAddressSpace, 
libunwind::Registers_x86_64>::setInfoBasedOnIPRegister (this=0x7fffffa07cb0, 
isReturnAddress=false)
    at /home/dima/work/llvm-project/libunwind/src/UnwindCursor.hpp:2561
#4238 0x00007ffff7f6477f in __unw_init_local (cursor=0x7fffffa07cb0, 
context=0x7fffffa07c08) at 
/home/dima/work/llvm-project/libunwind/src/libunwind.cpp:91
#4239 0x00007ffff7fb2f48 in _Unwind_Backtrace (callback=0x55555561be20 
<Unwind_Trace()>, ref=0x7fffffa07de8) at 
/home/dima/work/llvm-project/libunwind/src/UnwindLevel1-gcc-ext.c:137
#4240 0x000055555561bdcb in UnwindSlow () at 
/home/dima/work/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp:130
#4241 0x0000555555615455 in __sanitizer::BufferedStackTrace::Unwind(unsigned 
int, unsigned long, unsigned long, void*, unsigned long, unsigned long, bool) ()
    at 
/home/dima/work/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:158
#4242 0x0000555555587985 in UnwindImpl () at 
/home/dima/work/llvm-project/compiler-rt/lib/msan/msan.cpp:342
#4243 0x0000555555587578 in Unwind () at 
/home/dima/work/llvm-project/compiler-rt/lib/msan/../sanitizer_common/sanitizer_stacktrace.h:130
#4244 PrintWarningWithOrigin () at 
/home/dima/work/llvm-project/compiler-rt/lib/msan/msan.cpp:247
#4245 0x0000555555587eb2 in __msan_warning_with_origin_noreturn () at 
/home/dima/work/llvm-project/compiler-rt/lib/msan/msan.cpp:422

```

There were also regular msan reports fixed by modifying tests srcs to add 
explicit initialization of unw_cursor_t and unw_context_t variables:

```
# .---command stderr------------
# | ==152363==WARNING: MemorySanitizer: use-of-uninitialized-value
# |     #0 0x7ffff7fa6564  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test-suite-install/lib/x86_64-unknown-linux-gnu/libunwind.so.1+0x6564)
# |     #1 0x7ffff7fa6bee  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test-suite-install/lib/x86_64-unknown-linux-gnu/libunwind.so.1+0x6bee)
# |     #2 0x7ffff7fa28f9  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test-suite-install/lib/x86_64-unknown-linux-gnu/libunwind.so.1+0x28f9)
# |     #3 0x55555562481d  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0xd081d)
# |     #4 0x5555556248a6  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0xd08a6)
# |     #5 0x7ffff7945e07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 
98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
# |     #6 0x7ffff7945ecb  (/usr/lib/libc.so.6+0x25ecb) (BuildId: 
98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
# |     #7 0x555555587334  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0x33334)
# | 
# |   Uninitialized value was stored to memory at
# |     #0 0x55555558e52d  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0x3a52d)
# |     #1 0x7ffff7fa28dc  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test-suite-install/lib/x86_64-unknown-linux-gnu/libunwind.so.1+0x28dc)
# |     #2 0x55555562481d  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0xd081d)
# |     #3 0x5555556248a6  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0xd08a6)
# |     #4 0x7ffff7945e07  (/usr/lib/libc.so.6+0x25e07) (BuildId: 
98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
# |     #5 0x7ffff7945ecb  (/usr/lib/libc.so.6+0x25ecb) (BuildId: 
98b3d8e0b8c534c769cb871c438b4f8f3a8e4bf3)
# |     #6 0x555555587334  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0x33334)
# | 
# |   Uninitialized value was created by an allocation of 'context' in the 
stack frame
# |     #0 0x5555556247bc  
(/home/dima/work/llvm-project/build/runtimes/runtimes-bins/libunwind/test/Output/unw_resume.pass.cpp.dir/t.tmp.exe+0xd07bc)

```

https://github.com/llvm/llvm-project/pull/120013
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to