[PATCH] D138986: [AIX][BigArchive] Treat the archive is empty if the first child member offset is zero

Mitch Phillips via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 30 09:41:23 PST 2023


hctim added a comment.

Looks like this patch still causes errors on the ASan buildbot, even with D142883 <https://reviews.llvm.org/D142883> patched in.

You can reproduce using the upstream buildbots (https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild), but a quick-asan-build that's hacked together might be easier for iterative testing:

  $ cmake \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DLLVM_USE_LINKER=lld \
  -GNinja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_FLAGS="-fsanitize=address" \
  -DCMAKE_CXX_FLAGS="-fsanitize=address" \
  -DLLVM_ENABLE_PROJECTS="'clang;lld;clang-tools-extra;mlir'" \
  -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi" \
  -DLLVM_LIBC_ENABLE_LINTING=OFF \
  -DLLVM_USE_SANITIZER=Address \
  -DLLVM_ENABLE_ASSERTIONS=On \
  /llvm/llvm



  $ LIT_OPTS='--filter=Object/archive-big-malformed-first-member.test' ninja check-llvm
  [0/1] Running the LLVM regression tests
  -- Testing: 1 of 47854 tests, 1 workers --
  Testing: 
  FAIL: LLVM :: Object/archive-big-malformed-first-member.test (1 of 1)
  ******************** TEST 'LLVM :: Object/archive-big-malformed-first-member.test' FAILED ********************
  Script:
  --
  : 'RUN: at line 2';   echo    "<bigaf>" > /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a
  : 'RUN: at line 3';   echo -n "0                   0                   0                   128                 0                   0                   " >> /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a
  : 'RUN: at line 4';   not /llvm-build/asan-test/bin/llvm-ar tv /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a 2>&1 | /llvm-build/asan-test/bin/FileCheck /llvm/llvm/test/Object/archive-big-malformed-first-member.test
  : 'RUN: at line 5';   echo    "<bigaf>" > /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a
  : 'RUN: at line 6';   echo -n "0                   0                   0                   28                  0                   0                   " >> /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a
  : 'RUN: at line 7';   not /llvm-build/asan-test/bin/llvm-ar tv /llvm-build/asan-test/test/Object/Output/archive-big-malformed-first-member.test.tmp.a 2>&1 | /llvm-build/asan-test/bin/FileCheck /llvm/llvm/test/Object/archive-big-malformed-first-member.test
  --
  Exit Code: 1
  
  Command Output (stderr):
  --
  /llvm/llvm/test/Object/archive-big-malformed-first-member.test:8:10: error: CHECK: expected string not found in input
  # CHECK: truncated or malformed archive
           ^
  <stdin>:1:1: note: scanning from here
  =================================================================
  ^
  <stdin>:26:1: note: possible intended match here
  allocated by thread T0 here:
  ^
  
  Input file: <stdin>
  Check file: /llvm/llvm/test/Object/archive-big-malformed-first-member.test
  
  -dump-input=help explains the following input dump.
  
  Input was:
  <<<<<<
             1: ================================================================= 
  check:8'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
             2: ==1479148==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000016b at pc 0x55ae87121dfa bp 0x7ffcb19a9d10 sp 0x7ffcb19a9d08 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             3: READ of size 1 at 0x61200000016b thread T0 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             4:  #0 0x55ae87121df9 in llvm::StringRef::find_last_not_of(llvm::StringRef, unsigned long) const /llvm/llvm/lib/Support/StringRef.cpp:307:39 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             5:  #1 0x55ae86ddea92 in rtrim /llvm/llvm/include/llvm/ADT/StringRef.h:798:50 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             6:  #2 0x55ae86ddea92 in getFieldRawString<char, 4UL> /llvm/llvm/lib/Object/Archive.cpp:66:30 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
            21:  #17 0x7f54b3a46189 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            22:  #18 0x7f54b3a46244 in __libc_start_main csu/../csu/libc-start.c:381:3 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            23:  #19 0x55ae85fd0470 in _start (/llvm-build/asan-test/bin/llvm-ar+0x3a97470) 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            24:  
  check:8'0     ~
            25: 0x61200000016b is located 6 bytes to the right of 293-byte region [0x612000000040,0x612000000165) 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            26: allocated by thread T0 here: 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  check:8'1     ?                             possible intended match
            27:  #0 0x55ae86084bdd in operator new(unsigned long, std::nothrow_t const&) /llvm/compiler-rt/lib/asan/asan_new_delete.cpp:101:3 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            28:  #1 0x55ae870cf61b in llvm::WritableMemoryBuffer::getNewUninitMemBuffer(unsigned long, llvm::Twine const&, std::optional<llvm::Align>) /llvm/llvm/lib/Support/MemoryBuffer.cpp:313:34 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            29:  #2 0x55ae870cfef2 in llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>> getOpenFileImpl<llvm::MemoryBuffer>(int, llvm::Twine const&, unsigned long, unsigned long, long, bool, bool, std::optional<llvm::Align>) /llvm/llvm/lib/Support/MemoryBuffer.cpp:493:7 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            30:  #3 0x55ae870ceeba in llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer, std::default_delete<llvm::MemoryBuffer>>> getFileAux<llvm::MemoryBuffer>(llvm::Twine const&, unsigned long, unsigned long, bool, bool, bool, std::optional<llvm::Align>) /llvm/llvm/lib/Support/MemoryBuffer.cpp:272:14 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            31:  #4 0x55ae870cecd5 in llvm::MemoryBuffer::getFile(llvm::Twine const&, bool, bool, bool, std::optional<llvm::Align>) /llvm/llvm/lib/Support/MemoryBuffer.cpp:251:10 
  check:8'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             .
             .
             .
  >>>>>>
  
  --
  
  ********************
  Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
  ********************
  Failed Tests (1):
    LLVM :: Object/archive-big-malformed-first-member.test
  
  
  Testing Time: 2.36s
    Excluded: 45318
    Failed  :     1
  FAILED: test/CMakeFiles/check-llvm /llvm-build/asan-test/test/CMakeFiles/check-llvm 
  cd /llvm-build/asan-test/test && /usr/bin/python3 /llvm-build/asan-test/./bin/llvm-lit -sv /llvm-build/asan-test/test
  ninja: build stopped: subcommand failed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138986/new/

https://reviews.llvm.org/D138986



More information about the llvm-commits mailing list