[libc-commits] [libc] Turn LIBC_COPT_STRING_UNSAFE_WIDE_READ on by default (PR #144163)
LLVM Continuous Integration via libc-commits
libc-commits at lists.llvm.org
Fri Jun 13 15:12:35 PDT 2025
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-fullbuild-dbg-asan` running on `libc-x86_64-debian-fullbuild` while building `libc` at step 4 "annotate".
Full details are available at: https://lab.llvm.org/buildbot/#/builders/171/builds/23876
<details>
<summary>Here is the relevant piece of the build log for the reference</summary>
```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN ] LlvmLibcFMaxTest.InfArg
[ OK ] LlvmLibcFMaxTest.InfArg (16 us)
[ RUN ] LlvmLibcFMaxTest.NegInfArg
[ OK ] LlvmLibcFMaxTest.NegInfArg (12 us)
[ RUN ] LlvmLibcFMaxTest.BothZero
[ OK ] LlvmLibcFMaxTest.BothZero (9 us)
[ RUN ] LlvmLibcFMaxTest.Range
[ OK ] LlvmLibcFMaxTest.Range (379 ms)
Ran 5 tests. PASS: 5 FAIL: 0
[276/1270] Running unit test libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT
FAILED: libc/test/src/__support/HashTable/CMakeFiles/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable/CMakeFiles/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT.__build__
[==========] Running 4 tests from 1 test suite.
[ RUN ] LlvmLibcTableTest.AllocationAndDeallocation
=================================================================
==359352==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5628d0692700 at pc 0x5628d0638eb1 bp 0x7ffdce8f2640 sp 0x7ffdce8f2638
READ of size 4 at 0x5628d0692700 thread T0
#0 0x5628d0638eb0 in unsigned long __llvm_libc_20_0_0_git::internal::string_length_wide_read<unsigned int>(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26
#1 0x5628d0638da4 in unsigned long __llvm_libc_20_0_0_git::internal::string_length<char>(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:92:12
#2 0x5628d0638d89 in __llvm_libc_20_0_0_git::strlen(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/strlen.cpp:22:10
#3 0x5628d06313aa in __llvm_libc_20_0_0_git::internal::HashTable::oneshot_hash(char const*) const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/HashTable/table.h:179:24
#4 0x5628d062e410 in __llvm_libc_20_0_0_git::internal::HashTable::find(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/HashTable/table.h:340:24
#5 0x5628d062aadd in __llvm_libc_20_0_0_git::internal::LlvmLibcTableTest_AllocationAndDeallocation::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:26:7
#6 0x5628d063d557 in __llvm_libc_20_0_0_git::testing::Test::runTests(__llvm_libc_20_0_0_git::testing::TestOptions const&) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
#7 0x5628d067b408 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
#8 0x7fe547c46249 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
0x5628d0692700 is located 32 bytes to the left of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:19:37' (0x5628d0692720) of size 2
'<string literal>' is ascii string 'a'
0x5628d0692701 is located 0 bytes to the right of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:19:25' (0x5628d0692700) of size 1
'<string literal>' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26 in unsigned long __llvm_libc_20_0_0_git::internal::string_length_wide_read<unsigned int>(char const*)
Shadow bytes around the buggy address:
0x0ac59a0ca490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4d0: 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9
=>0x0ac59a0ca4e0:[01]f9 f9 f9 02 f9 f9 f9 03 f9 f9 f9 04 f9 f9 f9
0x0ac59a0ca4f0: 05 f9 f9 f9 06 f9 f9 f9 07 f9 f9 f9 00 f9 f9 f9
0x0ac59a0ca500: 00 01 f9 f9 00 02 f9 f9 00 03 f9 f9 06 f9 f9 f9
0x0ac59a0ca510: 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
0x0ac59a0ca520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca530: 00 02 f9 f9 f9 f9 f9 f9 00 00 01 f9 f9 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Step 8 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN ] LlvmLibcFMaxTest.InfArg
[ OK ] LlvmLibcFMaxTest.InfArg (16 us)
[ RUN ] LlvmLibcFMaxTest.NegInfArg
[ OK ] LlvmLibcFMaxTest.NegInfArg (12 us)
[ RUN ] LlvmLibcFMaxTest.BothZero
[ OK ] LlvmLibcFMaxTest.BothZero (9 us)
[ RUN ] LlvmLibcFMaxTest.Range
[ OK ] LlvmLibcFMaxTest.Range (379 ms)
Ran 5 tests. PASS: 5 FAIL: 0
[276/1270] Running unit test libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT
FAILED: libc/test/src/__support/HashTable/CMakeFiles/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable/CMakeFiles/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/build/libc/test/src/__support/HashTable/libc.test.src.__support.HashTable.table_test.__unit__.__NO_EXPLICIT_SIMD_OPT.__build__
[==========] Running 4 tests from 1 test suite.
[ RUN ] LlvmLibcTableTest.AllocationAndDeallocation
=================================================================
==359352==ERROR: AddressSanitizer: global-buffer-overflow on address 0x5628d0692700 at pc 0x5628d0638eb1 bp 0x7ffdce8f2640 sp 0x7ffdce8f2638
READ of size 4 at 0x5628d0692700 thread T0
#0 0x5628d0638eb0 in unsigned long __llvm_libc_20_0_0_git::internal::string_length_wide_read<unsigned int>(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26
#1 0x5628d0638da4 in unsigned long __llvm_libc_20_0_0_git::internal::string_length<char>(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:92:12
#2 0x5628d0638d89 in __llvm_libc_20_0_0_git::strlen(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/strlen.cpp:22:10
#3 0x5628d06313aa in __llvm_libc_20_0_0_git::internal::HashTable::oneshot_hash(char const*) const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/HashTable/table.h:179:24
#4 0x5628d062e410 in __llvm_libc_20_0_0_git::internal::HashTable::find(char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/__support/HashTable/table.h:340:24
#5 0x5628d062aadd in __llvm_libc_20_0_0_git::internal::LlvmLibcTableTest_AllocationAndDeallocation::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:26:7
#6 0x5628d063d557 in __llvm_libc_20_0_0_git::testing::Test::runTests(__llvm_libc_20_0_0_git::testing::TestOptions const&) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
#7 0x5628d067b408 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
#8 0x7fe547c46249 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
0x5628d0692700 is located 32 bytes to the left of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:19:37' (0x5628d0692720) of size 2
'<string literal>' is ascii string 'a'
0x5628d0692701 is located 0 bytes to the right of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/test/src/__support/HashTable/table_test.cpp:19:25' (0x5628d0692700) of size 1
'<string literal>' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian-fullbuild/libc-x86_64-debian-fullbuild-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26 in unsigned long __llvm_libc_20_0_0_git::internal::string_length_wide_read<unsigned int>(char const*)
Shadow bytes around the buggy address:
0x0ac59a0ca490: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca4d0: 00 00 00 00 00 00 00 00 00 00 00 f9 f9 f9 f9 f9
=>0x0ac59a0ca4e0:[01]f9 f9 f9 02 f9 f9 f9 03 f9 f9 f9 04 f9 f9 f9
0x0ac59a0ca4f0: 05 f9 f9 f9 06 f9 f9 f9 07 f9 f9 f9 00 f9 f9 f9
0x0ac59a0ca500: 00 01 f9 f9 00 02 f9 f9 00 03 f9 f9 06 f9 f9 f9
0x0ac59a0ca510: 00 00 00 00 02 f9 f9 f9 f9 f9 f9 f9 00 00 00 00
0x0ac59a0ca520: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ac59a0ca530: 00 02 f9 f9 f9 f9 f9 f9 00 00 01 f9 f9 f9 f9 f9
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
```
</details>
https://github.com/llvm/llvm-project/pull/144163
More information about the libc-commits
mailing list