Strange problem with sanitizer

Hi,
I tried to sanitize my code and all sanitizers pass fine, except for 'memory'. Then, I discovered it fails even on hello world project:

[lukasz@localhost tmp]$ cargo init hello
Created binary (application) package
[lukasz@localhost tmp]$ cd hello
[lukasz@localhost hello]$ RUSTFLAGS="-Z sanitizer=memory" cargo +nightly run --target x86_64-unknown-linux-gnu
Compiling hello v0.1.0 (/tmp/hello)
Finished dev [unoptimized + debuginfo] target(s) in 0.79s
Running target/x86_64-unknown-linux-gnu/debug/hello
Uninitialized bytes in __interceptor_memchr at offset 0 inside [0x701000000000, 4)
==27610==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x56500e54fd0e (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0x68d0e)
#1 0x56500e5568ce (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0x6f8ce)
#2 0x56500e4f1a5d (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0xaa5d)
#3 0x56500e4f23c1 (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0xb3c1)
#4 0x7f8aa2942fe9 (/lib64/libc.so.6+0x20fe9)
#5 0x56500e4f1879 (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0xa879)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/tmp/hello/target/x86_64-unknown-linux-gnu/debug/hello+0x68d0e) 
Exiting

Is this a bug in nightly?
Thanks,
Lukasz

I've not heard of anyone being able to successfully apply MSan to Rust applications. For example, it's known to produce use-of-uninitialized-value when running tests, making it impossible to use MSan with your tests.

If you want something similar, with less false-positives, try libdiffuzz.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.