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

Squash MSAN false positives #11915

Open
jonathanmetzman opened this issue May 6, 2024 · 9 comments
Open

Squash MSAN false positives #11915

jonathanmetzman opened this issue May 6, 2024 · 9 comments

Comments

@jonathanmetzman
Copy link
Contributor

Some of these may have been caused by the compiler roll.
CC @maflcko

@jonathanmetzman
Copy link
Contributor Author

Related: #11886

@johnstiles-google
Copy link
Contributor

This is causing issues while fuzzing libjpeg-turbo. See libjpeg-turbo/libjpeg-turbo#761

@johnstiles-google
Copy link
Contributor

This might be driven by a new flag: https://reviews.llvm.org/D134669

-fsanitize-memory-param-retval

@maflcko
Copy link
Contributor

maflcko commented May 7, 2024

This might be driven by a new flag: https://reviews.llvm.org/D134669

-fsanitize-memory-param-retval

Yes, this was intentional, so it is a true positive. The flag is turned on by default since clang 16, according to https://releases.llvm.org/16.0.0/tools/clang/docs/ReleaseNotes.html#sanitizers . It is possible to turn off the flag on a per-project basis, or in the base image flags, but I am not sure that'd be a good idea, as that may be hiding real bugs.

@maflcko
Copy link
Contributor

maflcko commented May 7, 2024

The CI-Fuzz issue is a false positive and should be fixed when the image was re-built, according to #11886 (comment) ?

Are there any other issues that I am not aware of?

@jonathanmetzman
Copy link
Contributor Author

The CI-Fuzz issue is a false positive and should be fixed when the image was re-built, according to #11886 (comment) ?

Sorry the CIFuzz comment is a bit hard to parse. I was sayign that the images are building, so the problem is not simply due to the builder image being out of date.

I haven't looked into this too closely but I think John is saying it is a false positive.

@maflcko
Copy link
Contributor

maflcko commented May 7, 2024

@johnstiles-google
Copy link
Contributor

I haven't looked into this too closely but I think John is saying it is a false positive.

It wasn't entirely a "false positive", but it was confusing because MSAN's new behavior violates the documentation's explanation of how MSAN works.

https://github.com/google/sanitizers/wiki/MemorySanitizer#introduction

MSan is bit-exact: it can track uninitialized bits in a bitfield. It will tolerate copying of uninitialized memory, and also simple logic and arithmetic operations with it. In general, MSan silently tracks the spread of uninitialized data in memory, and reports a warning when a code branch is taken (or not taken) depending on an uninitialized value.

The new behavior violates this rule. Passing an uninitialized value to a function is "spreading" it, not "branching" on it. I understand that it is UB, but MSAN historically hasn't made its mission to report UB—it has been to track the spread of uninitialized data, and report when the code makes decisions based on it.

So it's a false positive from that perspective, but apparently this is intentional and everyone agrees that it's a good change. In that case it's not a false positive, but the docs are wrong, so they should be updated.

@johnstiles-google
Copy link
Contributor

Filed google/sanitizers#1755. If you are OK with the amended phrasing that I made up in the bug,I can send a PR.

jonathanmetzman added a commit that referenced this issue May 8, 2024
It causes false positives.

Related: #11915
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