Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when building instrumented std and with memory sanitizer #68548

Closed
tesuji opened this issue Jan 26, 2020 · 11 comments
Closed

Comments

@tesuji
Copy link
Contributor

tesuji commented Jan 26, 2020

cc #68539

Consider this snippet:

fn main() {
    println!("Hello, world!");
}

I got segmentation fault when building instrumented std:

% env RUSTFLAGS="-Zsanitizer=memory -Cllvm-args=-msan-track-origins=2" cargo -Zbuild-std build --target x86_64-unknown-linux-gnu
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
% rust-gdb -q /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check                                           
Reading symbols from /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check...done.
(gdb) r
Starting program: /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__sanitizer::internal_memset(void*, int, unsigned long) () at /checkout/src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc:93
93      /checkout/src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc: No such file or directory.
(gdb) quit

 % valgrind -q /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check 
==11856== Invalid write of size 1
==11856==    at 0x1CFD50: __sanitizer::internal_memset(void*, int, unsigned long) (src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc:93)
==11856==    by 0x32601E: std::sys::unix::args::imp::ARGV_INIT_ARRAY::init_wrapper (args.rs:114)
==11856==    by 0x62E1E4: __libc_csu_init (in /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check)
==11856==    by 0x48C6029: (below main) (libc-start.c:264)
==11856==  Address 0x501ffefffd20 is not stack'd, malloc'd or (recently) free'd
==11856== 
==11856== 
==11856== Process terminating with default action of signal 11 (SIGSEGV)
==11856==  Access not within mapped region at address 0x501FFEFFFD20
==11856==    at 0x1CFD50: __sanitizer::internal_memset(void*, int, unsigned long) (src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_libc.cc:93)
==11856==    by 0x32601E: std::sys::unix::args::imp::ARGV_INIT_ARRAY::init_wrapper (args.rs:114)
==11856==    by 0x62E1E4: __libc_csu_init (in /home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check)
==11856==    by 0x48C6029: (below main) (libc-start.c:264)
==11856==  If you believe this happened as a result of a stack
==11856==  overflow in your program's main thread (unlikely but
==11856==  possible), you can try to increase the size of the
==11856==  main thread stack using the --main-stacksize= flag.
==11856==  The main thread stack size used in this run was 8388608.

Meta:

  • rustc 1.42.0-nightly (c2d141d 2020-01-24)

Originally posted by @lzutao in #68539 (comment)

@tesuji
Copy link
Contributor Author

tesuji commented Jan 26, 2020

New rustc (rustc 1.42.0-nightly (6d3f4e0 2020-01-25)) doesn't segfault.
But has a memory sanitizer error:

% env RUSTFLAGS="-Zsanitizer=memory -Cllvm-args=-msan-track-origins=2" cargo -Zbuild-std r --target x86_64-unknown-linux-gnu    
   Compiling check v0.1.0 (/home/lzutao/fork/rust/check)
    Finished dev [unoptimized + debuginfo] target(s) in 0.16s
     Running `/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check`
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==16270==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5558c424730e in std::sys::unix::memchr::memchr::h093351bf413e1811 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/sys/unix/memchr.rs:6:8
    #1 0x5558c424730e in std::memchr::memchr::h611c7bcd6977d5c8 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/memchr.rs:25:4
    #2 0x5558c424730e in std::ffi::c_str::CString::_new::hae9b6987fec5f7fd /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/ffi/c_str.rs:354:14
    #3 0x5558c424730e in std::ffi::c_str::CString::new::h1ea624224271aaf7 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/ffi/c_str.rs:350:8
    #4 0x5558c424730e in std::thread::Thread::new::_$u7b$$u7b$closure$u7d$$u7d$::h1c0ee72b60a277c3 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/thread/mod.rs:1139:25
    #5 0x5558c424730e in core::option::Option$LT$T$GT$::map::hcc879affbaa7fe1d /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libcore/option.rs:450:28
    #6 0x5558c424730e in std::thread::Thread::new::h50a07a669fcb2430 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/thread/mod.rs:1139:12
    #7 0x5558c424dbf8 in std::rt::lang_start_internal::h9d8db41cd41d5c82 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:44:21
    #8 0x5558c42441aa in std::rt::lang_start::h49972300d46b5330 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:67:4
    #9 0x5558c42453ec in main (/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check+0x913ec)
    #10 0x7f01d935d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #11 0x5558c41e8029 in _start (/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check+0x34029)

  Uninitialized value was created by a heap allocation
    #0 0x5558c41f2f9d in malloc /checkout/src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cc:916:3
    #1 0x5558c424dbbb in alloc::alloc::alloc::hcdcb9b2beecd2386 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/alloc.rs:81:4
    #2 0x5558c424dbbb in _$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Alloc$GT$::alloc::h6874ec33458db448 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/alloc.rs:169:21
    #3 0x5558c424dbbb in alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::h6551de8396f43b6a /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/raw_vec.rs:88:73
    #4 0x5558c424dbbb in alloc::raw_vec::RawVec$LT$T$GT$::with_capacity::ha9f3e23fbbb76ceb /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/raw_vec.rs:140:8
    #5 0x5558c424dbbb in alloc::vec::Vec$LT$T$GT$::with_capacity::h07a6336c6cdafeb1 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/vec.rs:355:19
    #6 0x5558c424dbbb in alloc::slice::hack::to_vec::h9cacb4bd68db4f4e /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:158:25
    #7 0x5558c424dbbb in alloc::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::to_vec::hb97d0cd8f5bb7f3b /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:394:8
    #8 0x5558c424dbbb in alloc::slice::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$$u5b$T$u5d$$GT$::to_owned::h2141d6531caed0bc /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:727:8
    #9 0x5558c424dbbb in alloc::str::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h8c20d4eb37699c47 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/str.rs:205:45
    #10 0x5558c424dbbb in std::rt::lang_start_internal::h9d8db41cd41d5c82 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:44:38

SUMMARY: MemorySanitizer: use-of-uninitialized-value /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/sys/unix/memchr.rs:6:8 in std::sys::unix::memchr::memchr::h093351bf413e1811
Exiting

cc @nagisa

@tmiasko
Copy link
Contributor

tmiasko commented Jan 26, 2020

Looks like a bug in cargo. Notice difference between cargo run / cargo r.
The former builds properly instrumented binary while the latter does not.

$ export env RUSTFLAGS="-Zsanitizer=memory -Zsanitizer-memory-track-origins"
$ cargo -Zbuild-std run --target x86_64-unknown-linux-gnu
    Finished dev [unoptimized + debuginfo] target(s) in 0.10s
     Running `target/x86_64-unknown-linux-gnu/debug/foo`
Hello, world!
$ cargo -Zbuild-std r --target x86_64-unknown-linux-gnu
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/x86_64-unknown-linux-gnu/debug/foo`
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==5321==WARNING: MemorySanitizer: use-of-uninitialized-value
...

@tesuji
Copy link
Contributor Author

tesuji commented Jan 26, 2020

Yeah. It's super weird. Notice the different: cargo run / cargo r

% env RUSTFLAGS="-Zsanitizer=memory -Cllvm-args=-msan-track-origins=2" cargo -Zbuild-std run
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check`
zsh: segmentation fault  env RUSTFLAGS="-Zsanitizer=memory -Cllvm-args=-msan-track-origins=2" cargo
% env RUSTFLAGS="-Zsanitizer=memory -Cllvm-args=-msan-track-origins=2" cargo -Zbuild-std r
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check`
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==31792==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55eb5be5430e in std::sys::unix::memchr::memchr::h093351bf413e1811 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/sys/unix/memchr.rs:6:8
    #1 0x55eb5be5430e in std::memchr::memchr::h611c7bcd6977d5c8 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/memchr.rs:25:4
    #2 0x55eb5be5430e in std::ffi::c_str::CString::_new::hae9b6987fec5f7fd /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/ffi/c_str.rs:354:14
    #3 0x55eb5be5430e in std::ffi::c_str::CString::new::h1ea624224271aaf7 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/ffi/c_str.rs:350:8
    #4 0x55eb5be5430e in std::thread::Thread::new::_$u7b$$u7b$closure$u7d$$u7d$::h1c0ee72b60a277c3 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/thread/mod.rs:1139:25
    #5 0x55eb5be5430e in core::option::Option$LT$T$GT$::map::hcc879affbaa7fe1d /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libcore/option.rs:450:28
    #6 0x55eb5be5430e in std::thread::Thread::new::h50a07a669fcb2430 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/thread/mod.rs:1139:12
    #7 0x55eb5be5abf8 in std::rt::lang_start_internal::h9d8db41cd41d5c82 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:44:21
    #8 0x55eb5be511aa in std::rt::lang_start::h49972300d46b5330 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:67:4
    #9 0x55eb5be523ec in main (/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check+0x913ec)
    #10 0x7fcb662fe09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #11 0x55eb5bdf5029 in _start (/home/lzutao/.cargo/target_dir/x86_64-unknown-linux-gnu/debug/check+0x34029)

  Uninitialized value was created by a heap allocation
    #0 0x55eb5bdfff9d in malloc /checkout/src/llvm-project/compiler-rt/lib/msan/msan_interceptors.cc:916:3
    #1 0x55eb5be5abbb in alloc::alloc::alloc::hcdcb9b2beecd2386 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/alloc.rs:81:4
    #2 0x55eb5be5abbb in _$LT$alloc..alloc..Global$u20$as$u20$core..alloc..Alloc$GT$::alloc::h6874ec33458db448 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/alloc.rs:169:21
    #3 0x55eb5be5abbb in alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::h6551de8396f43b6a /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/raw_vec.rs:88:73
    #4 0x55eb5be5abbb in alloc::raw_vec::RawVec$LT$T$GT$::with_capacity::ha9f3e23fbbb76ceb /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/raw_vec.rs:140:8
    #5 0x55eb5be5abbb in alloc::vec::Vec$LT$T$GT$::with_capacity::h07a6336c6cdafeb1 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/vec.rs:355:19
    #6 0x55eb5be5abbb in alloc::slice::hack::to_vec::h9cacb4bd68db4f4e /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:158:25
    #7 0x55eb5be5abbb in alloc::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::to_vec::hb97d0cd8f5bb7f3b /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:394:8
    #8 0x55eb5be5abbb in alloc::slice::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$$u5b$T$u5d$$GT$::to_owned::h2141d6531caed0bc /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/slice.rs:727:8
    #9 0x55eb5be5abbb in alloc::str::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h8c20d4eb37699c47 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/liballoc/str.rs:205:45
    #10 0x55eb5be5abbb in std::rt::lang_start_internal::h9d8db41cd41d5c82 /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/rt.rs:44:38

SUMMARY: MemorySanitizer: use-of-uninitialized-value /rustc/6d3f4e0aab3e36ceb8b83d1e9467514685f6b751/src/libstd/sys/unix/memchr.rs:6:8 in std::sys::unix::memchr::memchr::h093351bf413e1811
Exiting

.cargo/config:

[alias]
br = 'build --release'
rr = 'run --release'
f = 'fmt'

@tesuji
Copy link
Contributor Author

tesuji commented Jan 26, 2020

cc @ehuss (cargo team member for #68548 (comment))

@tmiasko
Copy link
Contributor

tmiasko commented Jan 26, 2020

The segmentation fault is probably a duplicate of #68367. Especially if it can be avoided by removing track-origins functionality or when using a newer rustc.

@tesuji
Copy link
Contributor Author

tesuji commented Jan 26, 2020

I was using today nightly.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 26, 2020

Things you can try:

  • Remove origins tracking (and don't use it in any of following steps).
  • Check memory sanitizer works in clang https://clang.llvm.org/docs/MemorySanitizer.html
  • Check output while running with MSAN_OPTIONS=verbosity=2, is MemorySanitizer init done printed before crash?
  • Run under debugger and show complete stack trace and address that is being accessed.

@tesuji
Copy link
Contributor Author

tesuji commented Jan 26, 2020

Seems like my manually installed llvm has problems. It missed the compiler-rt toolchain
and I took a lot of time to build it. Finally I download the separate compiler-rt package
and build it successfully.
Run the test again and it doesn't segfault anymore.
Closed as not a bug.
Thanks tmiasko for the helping.

@tesuji tesuji closed this as completed Jan 26, 2020
@chadbrewbaker
Copy link

I am still getting this on nightly on AmazonLinux2.

# compiling uutils/coreutils
# rustc 1.52.0-nightly (fe1bf8e05 2021-02-23)
RUSTFLAGS=-Zsanitizer=memory MSAN_OPTIONS=verbosity=2 cargo test --target=x86_64-unknown-linux-gnu
...
 Running `/root/github/meta_coreutils/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f`
==363==MemorySanitizer: failed to intercept '__isoc99_printf'
'==363==MemorySanitizer: failed to intercept '__isoc99_sprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_snprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_fprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_vprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_vsprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_vsnprintf'
'==363==MemorySanitizer: failed to intercept '__isoc99_vfprintf'
'==363==MemorySanitizer: failed to intercept 'crypt'
'==363==MemorySanitizer: failed to intercept 'crypt_r'
'==363==Installed the sigaction for signal 11
==363==Installed the sigaction for signal 7
==363==Installed the sigaction for signal 8
__msan_init 0x5562988b87b0
app-1: 0 - ffffffffff
shadow-2: 10000000000 - fffffffffff
invalid: 100000000000 - 10ffffffffff
origin-2: 110000000000 - 1fffffffffff
shadow-3: 200000000000 - 2fffffffffff
origin-3: 300000000000 - 3fffffffffff
invalid: 400000000000 - 4fffffffffff
shadow-1: 500000000000 - 50ffffffffff
app-2: 510000000000 - 5fffffffffff
origin-1: 600000000000 - 60ffffffffff
invalid: 610000000000 - 6fffffffffff
app-3: 700000000000 - 7fffffffffff
==363==Using llvm-symbolizer found at: /usr/bin/llvm-symbolizer
MemorySanitizer init done
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
Shadow map of [0x201000000000, 0x201000000004), 4 bytes:
0x201000000000: ffffffff ........ ........ ........

==363==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55629896c82a in std::sys::unix::memchr::memchr::h25e994819b34ae60 /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/sys/unix/memchr.rs:6:9
    #1 0x55629896c82a in std::memchr::memchr::hbfa59afe241958cf /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/memchr.rs:28:5
    #2 0x55629896c82a in std::ffi::c_str::CString::_new::h1135c0ef219c53d5 /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/ffi/c_str.rs:405:15
    #3 0x55629896c82a in std::ffi::c_str::CString::new::hfad134e936e82551 /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/ffi/c_str.rs:401:9
    #4 0x55629896c82a in std::thread::Thread::new::_$u7b$$u7b$closure$u7d$$u7d$::hd79cbaf3f8b96dcf /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/thread/mod.rs:1068:26
    #5 0x55629896c82a in core::option::Option$LT$T$GT$::map::h6bf62377f786127c /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/core/src/option.rs:487:29
    #6 0x55629896c82a in std::thread::Thread::new::hdef806dddada2f31 /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/thread/mod.rs:1068:13
    #7 0x556298977b45 in std::rt::lang_start_internal::hc92e27a69d75de2a /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/rt.rs:44:22
    #8 0x5562989151cb in std::rt::lang_start::hd7b49f57b17ff86a /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/rt.rs:65:5
    #9 0x556298914b31 in main (/root/github/meta_coreutils/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0x73b31)
    #10 0x7f20421ba069 in __libc_start_main (/lib64/libc.so.6+0x21069)
    #11 0x5562988b81d9 in _start (/root/github/meta_coreutils/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0x171d9)

SUMMARY: MemorySanitizer: use-of-uninitialized-value /rustc/fe1bf8e05c39bdcc73fc09e246b7209444e389bc/library/std/src/sys/unix/memchr.rs:6:9 in std::sys::unix::memchr::memchr::h25e994819b34ae60
Exiting
error: test failed, to rerun pass '--bin coreutils'
-bash-4.2# /usr/bin/llvm-symbolizer --version
LLVM (http://llvm.org/):
  LLVM version 7.0.1
  Optimized build.
  Default target: x86_64-unknown-linux-gnu
  Host CPU: skylake

@chadbrewbaker
Copy link

It is even worse under Kali Rolling. (These are WSL2 runs if it matters) The symbols aren't expanded to source locations.

  Finished test [unoptimized + debuginfo] target(s) in 3m 55s
     Running target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f
==14228==MemorySanitizer: failed to intercept '__isoc99_printf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_sprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_snprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_fprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_vprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_vsprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_vsnprintf'
'==14228==MemorySanitizer: failed to intercept '__isoc99_vfprintf'
'==14228==MemorySanitizer: failed to intercept 'crypt'
'==14228==MemorySanitizer: failed to intercept 'crypt_r'
'==14228==Installed the sigaction for signal 11
==14228==Installed the sigaction for signal 7
==14228==Installed the sigaction for signal 8
__msan_init 0x559a9a5aa740
app-1: 0 - ffffffffff
shadow-2: 10000000000 - fffffffffff
invalid: 100000000000 - 10ffffffffff
origin-2: 110000000000 - 1fffffffffff
shadow-3: 200000000000 - 2fffffffffff
origin-3: 300000000000 - 3fffffffffff
invalid: 400000000000 - 4fffffffffff
shadow-1: 500000000000 - 50ffffffffff
app-2: 510000000000 - 5fffffffffff
origin-1: 600000000000 - 60ffffffffff
invalid: 610000000000 - 6fffffffffff
app-3: 700000000000 - 7fffffffffff
MemorySanitizer init done
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
Shadow map of [0x201000000000, 0x201000000004), 4 bytes:
0x201000000000: ffffffff ........ ........ ........

==14228==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x559a9a65e7ba  (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0xcb7ba)
    #1 0x559a9a669ad5  (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0xd6ad5)
    #2 0x559a9a60715b  (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0x7415b)
    #3 0x559a9a606ac1  (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0x73ac1)
    #4 0x7f3383b7bd09  (/lib/x86_64-linux-gnu/libc.so.6+0x26d09)
    #5 0x559a9a5aa169  (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0x17169)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/crb002/github/coreutils/target/x86_64-unknown-linux-gnu/debug/deps/coreutils-641830cd6c0f495f+0xcb7ba)
Exiting
error: test failed, to rerun pass '--bin coreutils'

@tesuji
Copy link
Contributor Author

tesuji commented Feb 25, 2021

@chadbrewbaker Please open an separate issue since this issue closed, your comments would be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants