[libc-commits] [libc] Create a poor-developer's msan for libc wide read functions. (PR #170586)
via libc-commits
libc-commits at lists.llvm.org
Wed Dec 3 16:42:10 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libc
Author: None (Sterling-Augustine)
<details>
<summary>Changes</summary>
Most libcs optimize functions like strlen by reading in chunks larger than a single character. As part of "the implementation", they can legally do this as long as they are careful not to read invalid memory.
However, such tricks prevents those functions from being tested under the various sanitizers.
This PR creates a test framework that can report when one of these functions read or write in an invalid way without using the sanitizers.
---
Full diff: https://github.com/llvm/llvm-project/pull/170586.diff
1 Files Affected:
- (modified) libc/test/src/strings/CMakeLists.txt (+10)
``````````diff
diff --git a/libc/test/src/strings/CMakeLists.txt b/libc/test/src/strings/CMakeLists.txt
index 5f70dc024f6ce..0ccd0dc302943 100644
--- a/libc/test/src/strings/CMakeLists.txt
+++ b/libc/test/src/strings/CMakeLists.txt
@@ -110,5 +110,15 @@ add_libc_test(
libc.src.strings.strncasecmp_l
)
+add_libc_test(
+ wide_read_memory_test
+ SUITE
+ libc-strings-tests
+ SRCS
+ wide_read_memory_test.cpp
+ DEPENDS
+ libc.src.string.strlen
+)
+
add_libc_multi_impl_test(bcmp libc-strings-tests SRCS bcmp_test.cpp)
add_libc_multi_impl_test(bzero libc-strings-tests SRCS bzero_test.cpp)
``````````
</details>
https://github.com/llvm/llvm-project/pull/170586
More information about the libc-commits
mailing list