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

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

Conversation

vitalybuka
Copy link
Collaborator

@vitalybuka vitalybuka commented Jul 30, 2024

Created using spr 1.3.4
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jul 30, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 30, 2024

@llvm/pr-subscribers-clang

Author: Vitaly Buka (vitalybuka)

Changes

Fixes google/sanitizers#1755.


Full diff: https://github.com/llvm/llvm-project/pull/101105.diff

1 Files Affected:

  • (modified) clang/docs/MemorySanitizer.rst (+8-1)
diff --git a/clang/docs/MemorySanitizer.rst b/clang/docs/MemorySanitizer.rst
index bcc6cc808e8ba..024bed25243b9 100644
--- a/clang/docs/MemorySanitizer.rst
+++ b/clang/docs/MemorySanitizer.rst
@@ -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 list cases when MemorySanitizer will report an error:
+
+* Conditional branches controlled by uninitialized values.
+* Using uninitalized pointers for memory accesses.
+* Passing and returning uninitialized values to/from function calls. Can be disabled with ``-fno-sanitize-memory-param-retval``.
+* Passing uninitialized data into libc calls.
+
 How to build
 ============
 

Created using spr 1.3.4
clang/docs/MemorySanitizer.rst Outdated Show resolved Hide resolved
clang/docs/MemorySanitizer.rst Outdated Show resolved Hide resolved
clang/docs/MemorySanitizer.rst Outdated Show resolved Hide resolved
@vitalybuka vitalybuka merged commit 1f3b0f4 into main Jul 30, 2024
4 of 6 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/docsmsan-list-common-cases-reported-by-msan branch July 30, 2024 17:14
* 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)

banach-space pushed a commit to banach-space/llvm-project that referenced this pull request Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MSAN] Update documentation now that sanitize-memory-param-retval is enabled
4 participants