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

[MSAN] Update documentation now that sanitize-memory-param-retval is enabled #1755

Closed
johnstiles-google opened this issue May 7, 2024 · 1 comment · Fixed by llvm/llvm-project#101105
Assignees

Comments

@johnstiles-google
Copy link

In Clang 16, -fsanitize-memory-param-retval was enabled by default. This is a good feature but it conflicts with the MSAN introduction text somewhat:

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.

sanitize-memory-param-retval does not work this way. Passing an uninitialized value to a function is "spreading" it, not "branching" on it.

We should amend this paragraph to avoid confusion. Something like:

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. MSan will also report a warning on certain types of undefined behavior, such as when a function call takes or returns uninitialized values.

@vitalybuka
Copy link
Contributor

Wiki is updated, clang doc is pending

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

Successfully merging a pull request may close this issue.

2 participants