-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[MSan] Fix minor issues in testcases #144073
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Member
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Kunqiu Chen (Camsyn) ChangesPreviously,
Full diff: https://github.com/llvm/llvm-project/pull/144073.diff 2 Files Affected:
diff --git a/compiler-rt/test/msan/ifaddrs.cpp b/compiler-rt/test/msan/ifaddrs.cpp
index 91730a01f2d8a..2379e8ebb6477 100644
--- a/compiler-rt/test/msan/ifaddrs.cpp
+++ b/compiler-rt/test/msan/ifaddrs.cpp
@@ -18,7 +18,7 @@
#define CHECK_AND_PUSH(addr, size) \
if (addr) { \
- assert(-1 == __msan_test_shadow(addr, sizeof(size))); \
+ assert(-1 == __msan_test_shadow(addr, (size_t)(size))); \
ranges.push_back(std::make_pair((void *)addr, (size_t)size)); \
}
diff --git a/compiler-rt/test/msan/qsort.cpp b/compiler-rt/test/msan/qsort.cpp
index af287ed64357e..93e6845e1ea7a 100644
--- a/compiler-rt/test/msan/qsort.cpp
+++ b/compiler-rt/test/msan/qsort.cpp
@@ -52,7 +52,7 @@ int compar1(const void *a, const void *b) {
// kind of random
for (int i = 0; i < kSize2; ++i)
p[i] = i * 2 + (i % 3 - 1) * 3;
- qsort(p, kSize1, sizeof(long), compar2);
+ qsort(p, kSize2, sizeof(long), compar2);
__msan_check_mem_is_initialized(p, sizeof(long) * kSize2);
delete[] p;
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
Previously, 1. ifaddrs.cpp : mistake `size_t (xxx)` as `sizeof (xxx)`, resulting in inadequate checks. 2. qsort.cpp : mistake `kSize2` as `kSize1`, resulting in an unexpected buffer overlow issue.
fmayer
approved these changes
Jun 13, 2025
Contributor
fmayer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
tomtor
pushed a commit
to tomtor/llvm-project
that referenced
this pull request
Jun 14, 2025
Previously, 1. ifaddrs.cpp : mistake `size_t (xxx)` as `sizeof (xxx)`, resulting in inadequate checks. 2. qsort.cpp : mistake `kSize2` as `kSize1`, resulting in an unexpected buffer overlow issue.
akuhlens
pushed a commit
to akuhlens/llvm-project
that referenced
this pull request
Jun 24, 2025
Previously, 1. ifaddrs.cpp : mistake `size_t (xxx)` as `sizeof (xxx)`, resulting in inadequate checks. 2. qsort.cpp : mistake `kSize2` as `kSize1`, resulting in an unexpected buffer overlow issue.
Camsyn
added a commit
that referenced
this pull request
Jul 25, 2025
Supplement to PR #144073 Previously, _msan_check_mem_is_initialized.cpp_ initialized a 32-byte stack array, but checked the shadow for the offset range [12, 42), exceeding the stack array size. MSan does not guarantee that the shadow corresponding to the overflow part is 0, so it is undefined to require the overflow part to be unpoisoned.
mahesh-attarde
pushed a commit
to mahesh-attarde/llvm-project
that referenced
this pull request
Jul 28, 2025
Supplement to PR llvm#144073 Previously, _msan_check_mem_is_initialized.cpp_ initialized a 32-byte stack array, but checked the shadow for the offset range [12, 42), exceeding the stack array size. MSan does not guarantee that the shadow corresponding to the overflow part is 0, so it is undefined to require the overflow part to be unpoisoned.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously,
size_t (xxx)assizeof (xxx), resulting ininadequate checks.
kSize2askSize1, resulting in an unexpectedbuffer overlow issue.