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

uninitialized value in nightly build with memory sanitizer #391

Closed
Byter09 opened this issue Apr 6, 2020 · 4 comments
Closed

uninitialized value in nightly build with memory sanitizer #391

Byter09 opened this issue Apr 6, 2020 · 4 comments

Comments

@Byter09
Copy link

Byter09 commented Apr 6, 2020

I'm currently fuzzing https://github.com/jyn514/rcc and noticed some totally unrelated crashes (they're stack overflows).

In the process however I wanted to change my script that runs the latest crash files to use a nightly and sanitized version of rcc. When using -Zsanitizer=memory compilation failed. At first it showed backtrace-sys with the warning use-of-uninitialized-value, however when testing that locally again, it showed log instead.

So I went ahead, downloaded log and ran:
RUSTFLAGS="-Awarnings -Zsanitizer=memory" cargo +nightly build.

This is the output:

   Compiling log v0.4.10 (/home/btr/Projects/clion/log)
   Compiling cfg-if v0.1.10
error: failed to run custom build command for `log v0.4.10 (/home/btr/Projects/clion/log)`

Caused by:
  process didn't exit successfully: `/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build` (exit code: 77)
--- stderr
==37637==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x5619ff54b846  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6b846)
    #1 0x5619ff54af6b  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6af6b)
    #2 0x5619ff54a985  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6a985)
    #3 0x5619ff555b17  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x75b17)
    #4 0x5619ff54a8cb  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6a8cb)
    #5 0x5619ff54b2d1  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6b2d1)
    #6 0x7f35497e6022  (/usr/lib/libc.so.6+0x27022)
    #7 0x5619ff4eb1ed  (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0xb1ed)

SUMMARY: MemorySanitizer: use-of-uninitialized-value (/home/btr/Projects/clion/log/target/debug/build/log-c3142b51c95ab84c/build-script-build+0x6b846) 
Exiting

This is not really my area of expertise so I hope you nice people know what to do with this.

Thanks!

@sfackler
Copy link
Member

sfackler commented Apr 6, 2020

The build script is extremely trivial: https://github.com/rust-lang/log/blob/master/build.rs

This sounds like a false positive to me I think.

@parasyte
Copy link

I hit this as well. More info in rust-lang/rust#39610

Workaround is using -Z build-std

@jyn514
Copy link
Member

jyn514 commented Oct 15, 2020

This should be closed in favor of rust-secure-code/wg#21 IMO.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 15, 2021

Thanks for the report @Byter09!

It looks like this is all sorted upstream so I’ll go ahead and close this one now.

@KodrAus KodrAus closed this as completed Nov 15, 2021
EFanZh pushed a commit to EFanZh/log that referenced this issue Jul 23, 2023
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

5 participants