Skip to content

[docs][msan] List common cases reported by msan #101105

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion clang/docs/MemorySanitizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ MemorySanitizer
Introduction
============

MemorySanitizer is a detector of uninitialized reads. It consists of a
MemorySanitizer is a detector of uninitialized memory use. It consists of a
compiler instrumentation module and a run-time library.

Typical slowdown introduced by MemorySanitizer is **3x**.

Here is a not comprehensive of list cases when MemorySanitizer will report an error:

* Uninitialized value was used in a conditional branch.
* Uninitialized pointer was used for memory accesses.
* Uninitialized value passed or returned from a function call, which is considered an undefined behavior. The check can be disabled with ``-fno-sanitize-memory-param-retval``.
* Uninitialized data was passed into some libc calls.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this redundant with "Uninitialized value passed or returned from a function call"?

Copy link
Collaborator Author

@vitalybuka vitalybuka Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In some cases they are redundant, but usually not
e.g fopen(file_path, ...)

param-retval will only check argument (pointer to C-string) if initialized
'libc` one will also check bytes in the string.

We can't check complex data structures or arrays without knowing details of called functions, but we know that about libc (glibc in case of msan)


How to build
============

Expand Down
Loading