[libc-commits] [libc] [libc] Fix readlink tests on 32-bit systems (PR #97850)

LLVM Continuous Integration via libc-commits libc-commits at lists.llvm.org
Fri Jul 5 11:22:36 PDT 2024


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/1446

Here is the relevant piece of the build log for the reference:
```
Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/libc-linux.py ...' (failure)
...
[ RUN      ] LlvmLibcRoundToIntegerTest.RoundNumbers
[       OK ] LlvmLibcRoundToIntegerTest.RoundNumbers (21 us)
[ RUN      ] LlvmLibcRoundToIntegerTest.SubnormalRange
[       OK ] LlvmLibcRoundToIntegerTest.SubnormalRange (1129 ms)
Ran 3 tests.  PASS: 3  FAIL: 0
[622/627] Building CXX object projects/libc/test/src/unistd/CMakeFiles/libc.test.src.unistd.readlinkat_test.__build__.dir/readlinkat_test.cpp.o
[623/627] Building CXX object projects/libc/test/src/unistd/CMakeFiles/libc.test.src.unistd.readlink_test.__build__.dir/readlink_test.cpp.o
[624/627] Linking CXX executable projects/libc/test/src/unistd/libc.test.src.unistd.readlinkat_test.__build__
[625/627] Linking CXX executable projects/libc/test/src/unistd/libc.test.src.unistd.readlink_test.__build__
[626/627] Running unit test libc.test.src.unistd.readlink_test
FAILED: projects/libc/test/src/unistd/CMakeFiles/libc.test.src.unistd.readlink_test /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/test/src/unistd/CMakeFiles/libc.test.src.unistd.readlink_test 
cd /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/test/src/unistd && /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/test/src/unistd/libc.test.src.unistd.readlink_test.__build__
[==========] Running 2 tests from 1 test suite.
[ RUN      ] LlvmLibcReadlinkTest.CreateAndUnlink
=================================================================
==2383243==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffd8b2ca728 at pc 0x55d62cef3bc5 bp 0x7ffd8b2ca410 sp 0x7ffd8b2ca408
READ of size 1 at 0x7ffd8b2ca728 thread T0
    #0 0x55d62cef3bc4 in __llvm_libc_19_0_0_git::cpp::string_view::compareMemory(char const*, char const*, unsigned long) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/CPP/string_view.h:34:27
    #1 0x55d62cef3bc4 in __llvm_libc_19_0_0_git::cpp::string_view::equals(__llvm_libc_19_0_0_git::cpp::string_view) const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/CPP/string_view.h:47:13
    #2 0x55d62cef3bc4 in __llvm_libc_19_0_0_git::cpp::string_view::operator==(__llvm_libc_19_0_0_git::cpp::string_view) const /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/CPP/string_view.h:111:65
    #3 0x55d62cef3bc4 in bool __llvm_libc_19_0_0_git::testing::internal::test<__llvm_libc_19_0_0_git::cpp::string_view>(__llvm_libc_19_0_0_git::testing::internal::RunContext*, __llvm_libc_19_0_0_git::testing::TestCond, __llvm_libc_19_0_0_git::cpp::string_view, __llvm_libc_19_0_0_git::cpp::string_view, char const*, char const*, __llvm_libc_19_0_0_git::testing::internal::Location) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.cpp:93:34
    #4 0x55d62cedcccc in bool __llvm_libc_19_0_0_git::testing::Test::test<__llvm_libc_19_0_0_git::cpp::string_view, 0>(__llvm_libc_19_0_0_git::testing::TestCond, __llvm_libc_19_0_0_git::cpp::string_view, __llvm_libc_19_0_0_git::cpp::string_view, char const*, char const*, __llvm_libc_19_0_0_git::testing::internal::Location) /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/UnitTest/LibcTest.h:170:12
    #5 0x55d62cedcccc in LlvmLibcReadlinkTest_CreateAndUnlink::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/unistd/readlink_test.cpp:38:3
    #6 0x55d62cee2480 in __llvm_libc_19_0_0_git::testing::Test::runTests(__llvm_libc_19_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
    #7 0x55d62cefc261 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:51:10
    #8 0x7f962e846249  (/lib/x86_64-linux-gnu/libc.so.6+0x27249) (BuildId: 58254ca972028402bc40624f81388d85ec95f70d)
    #9 0x7f962e846304 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x27304) (BuildId: 58254ca972028402bc40624f81388d85ec95f70d)
    #10 0x55d62ce1c3d0 in _start (/home/llvm-libc-buildbot/home/sivachandra/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/build/projects/libc/test/src/unistd/libc.test.src.unistd.readlink_test.__build__+0x243d0) (BuildId: ae0527b245e2d2309c0766c70ef97cc20a238829)

Address 0x7ffd8b2ca728 is located in stack of thread T0 at offset 360 in frame
    #0 0x55d62cedc5ef in LlvmLibcReadlinkTest_CreateAndUnlink::Run() /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/test/src/unistd/readlink_test.cpp:20

  This frame has 9 object(s):
    [32, 48) 'agg.tmp3269'
    [64, 80) 'agg.tmp2262'
    [96, 112) 'agg.tmp1154'
    [128, 144) 'agg.tmp50'
    [160, 184) 'LINK_VAL' (line 23)
    [224, 248) 'LINK' (line 25)
    [288, 320) 'ref.tmp' (line 32)
    [352, 360) 'buf' (line 34) <== Memory access at offset 360 overflows this variable
    [384, 416) 'ref.tmp29' (line 40)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/llvm-libc-buildbot/buildbot-worker/libc-x86_64-debian/libc-x86_64-debian-dbg-asan/llvm-project/libc/src/__support/CPP/string_view.h:34:27 in __llvm_libc_19_0_0_git::cpp::string_view::compareMemory(char const*, char const*, unsigned long)
Shadow bytes around the buggy address:
  0x100031651490: 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3 f3 f3 f3
  0x1000316514a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000316514b0: 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f8 f8 f2 f2

```

https://github.com/llvm/llvm-project/pull/97850


More information about the libc-commits mailing list