[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:15 PDT 2025
llvm-ci wrote:
LLVM Buildbot has detected a new failure on builder `libc-x86_64-debian-dbg-asan` running on `libc-x86_64-debian` while building `libc` at step 4 "annotate".
Full details are available at: https://lab.llvm.org/buildbot/#/builders/147/builds/22940
<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 ] LlvmLibcMemcmpTest.LhsBeforeRhsLexically
[ OK ] LlvmLibcMemcmpTest.LhsBeforeRhsLexically (2 us)
[ RUN ] LlvmLibcMemcmpTest.LhsAfterRhsLexically
[ OK ] LlvmLibcMemcmpTest.LhsAfterRhsLexically (3 us)
[ RUN ] LlvmLibcMemcmpTest.Issue77080
[ OK ] LlvmLibcMemcmpTest.Issue77080 (3 us)
[ RUN ] LlvmLibcMemcmpTest.SizeSweep
[ OK ] LlvmLibcMemcmpTest.SizeSweep (63 ms)
Ran 6 tests. PASS: 6 FAIL: 0
[927/1122] Running unit test libc.test.src.string.strcpy_test.__unit__
FAILED: libc/test/src/string/CMakeFiles/libc.test.src.string.strcpy_test.__unit__ /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string/CMakeFiles/libc.test.src.string.strcpy_test.__unit__
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string/libc.test.src.string.strcpy_test.__unit__.__build__
[==========] Running 3 tests from 1 test suite.
[ RUN ] LlvmLibcStrCpyTest.EmptySrc
=================================================================
==30946==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55a6b81c7680 at pc 0x55a6b816c191 bp 0x7ffd97e4b610 sp 0x7ffd97e4b608
READ of size 4 at 0x55a6b81c7680 thread T0
#0 0x55a6b816c190 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26
#1 0x55a6b816b134 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/string_utils.h:92:12
#2 0x55a6b816b0fb in __llvm_libc_20_0_0_git::strcpy(char*, char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/strcpy.cpp:22:17
#3 0x55a6b8169786 in LlvmLibcStrCpyTest_EmptySrc::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp:17:18
#4 0x55a6b8172a07 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
#5 0x55a6b81af9c8 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
#6 0x7fd87b966249 (/lib/x86_64-linux-gnu/libc.so.6+0x27249) (BuildId: 79005c16293efa45b441fed45f4f29b138557e9e)
0x55a6b81c7680 is located 32 bytes to the left of global variable '__const._ZN27LlvmLibcStrCpyTest_EmptySrc3RunEv.dest' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp' (0x55a6b81c76a0) of size 4
'__const._ZN27LlvmLibcStrCpyTest_EmptySrc3RunEv.dest' is ascii string 'abc'
0x55a6b81c7681 is located 0 bytes to the right of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp:14:23' (0x55a6b81c7680) of size 1
'<string literal>' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-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:
0x0ab557030e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030e90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0ab557030ed0:[01]f9 f9 f9 04 f9 f9 f9 05 f9 f9 f9 07 f9 f9 f9
0x0ab557030ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ef0: 00 02 f9 f9 f9 f9 f9 f9 06 f9 f9 f9 04 f9 f9 f9
0x0ab557030f00: 00 01 f9 f9 07 f9 f9 f9 00 01 f9 f9 00 00 00 06
0x0ab557030f10: f9 f9 f9 f9 00 00 00 07 f9 f9 f9 f9 00 00 00 00
0x0ab557030f20: f9 f9 f9 f9 00 00 00 04 f9 f9 f9 f9 00 00 00 05
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
Stack left redzone: f1
Stack mid redzone: f2
Step 7 (libc-unit-tests) failure: libc-unit-tests (failure)
...
[ RUN ] LlvmLibcMemcmpTest.LhsBeforeRhsLexically
[ OK ] LlvmLibcMemcmpTest.LhsBeforeRhsLexically (2 us)
[ RUN ] LlvmLibcMemcmpTest.LhsAfterRhsLexically
[ OK ] LlvmLibcMemcmpTest.LhsAfterRhsLexically (3 us)
[ RUN ] LlvmLibcMemcmpTest.Issue77080
[ OK ] LlvmLibcMemcmpTest.Issue77080 (3 us)
[ RUN ] LlvmLibcMemcmpTest.SizeSweep
[ OK ] LlvmLibcMemcmpTest.SizeSweep (63 ms)
Ran 6 tests. PASS: 6 FAIL: 0
[927/1122] Running unit test libc.test.src.string.strcpy_test.__unit__
FAILED: libc/test/src/string/CMakeFiles/libc.test.src.string.strcpy_test.__unit__ /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string/CMakeFiles/libc.test.src.string.strcpy_test.__unit__
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/libc/test/src/string/libc.test.src.string.strcpy_test.__unit__.__build__
[==========] Running 3 tests from 1 test suite.
[ RUN ] LlvmLibcStrCpyTest.EmptySrc
=================================================================
==30946==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55a6b81c7680 at pc 0x55a6b816c191 bp 0x7ffd97e4b610 sp 0x7ffd97e4b608
READ of size 4 at 0x55a6b81c7680 thread T0
#0 0x55a6b816c190 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/string_utils.h:73:26
#1 0x55a6b816b134 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/string_utils.h:92:12
#2 0x55a6b816b0fb in __llvm_libc_20_0_0_git::strcpy(char*, char const*) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/string/strcpy.cpp:22:17
#3 0x55a6b8169786 in LlvmLibcStrCpyTest_EmptySrc::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp:17:18
#4 0x55a6b8172a07 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/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:165:8
#5 0x55a6b81af9c8 in main /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTestMain.cpp:59:10
#6 0x7fd87b966249 (/lib/x86_64-linux-gnu/libc.so.6+0x27249) (BuildId: 79005c16293efa45b441fed45f4f29b138557e9e)
0x55a6b81c7680 is located 32 bytes to the left of global variable '__const._ZN27LlvmLibcStrCpyTest_EmptySrc3RunEv.dest' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp' (0x55a6b81c76a0) of size 4
'__const._ZN27LlvmLibcStrCpyTest_EmptySrc3RunEv.dest' is ascii string 'abc'
0x55a6b81c7681 is located 0 bytes to the right of global variable '<string literal>' defined in '/home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/string/strcpy_test.cpp:14:23' (0x55a6b81c7680) of size 1
'<string literal>' is ascii string ''
SUMMARY: AddressSanitizer: global-buffer-overflow /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-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:
0x0ab557030e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030e90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ea0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030eb0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ec0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0ab557030ed0:[01]f9 f9 f9 04 f9 f9 f9 05 f9 f9 f9 07 f9 f9 f9
0x0ab557030ee0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0ab557030ef0: 00 02 f9 f9 f9 f9 f9 f9 06 f9 f9 f9 04 f9 f9 f9
0x0ab557030f00: 00 01 f9 f9 07 f9 f9 f9 00 01 f9 f9 00 00 00 06
0x0ab557030f10: f9 f9 f9 f9 00 00 00 07 f9 f9 f9 f9 00 00 00 00
0x0ab557030f20: f9 f9 f9 f9 00 00 00 04 f9 f9 f9 f9 00 00 00 05
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
Stack left redzone: f1
Stack mid redzone: f2
```
</details>
https://github.com/llvm/llvm-project/pull/144163
More information about the libc-commits
mailing list