[lld] [lld-macho] Add support for non-lazy categories to ObjC category merger (PR #91548)

via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 10:52:28 PDT 2024


alx32 wrote:

> This might have broken a buildbot:
> 
> https://lab.llvm.org/buildbot/#/builders/5/builds/43261/steps/9/logs/stdio
> 
> ```
> FAIL: lld :: MachO/objc-category-merging-complete-test.s (15243 of 82613)
> ******************** TEST 'lld :: MachO/objc-category-merging-complete-test.s' FAILED ********************
> ...
> ==1885306==ERROR: AddressSanitizer: stack-use-after-return on address 0x7f86a1c54c78 at pc 0x5652c1d32412 bp 0x7f869cef18c0 sp 0x7f869cef1080
> READ of size 8 at 0x7f86a1c54c78 thread T5
>     #0 0x5652c1d32411 in __asan_memcpy /b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:63:3
>     #1 0x5652c2a11736 in lld::macho::ConcatInputSection::writeTo(unsigned char*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/lld/MachO/InputSection.cpp:218:3
>     #2 0x5652c2991cb3 in lld::macho::ConcatOutputSection::writeTo(unsigned char*) const /b/sanitizer-x86_64-linux-fast/build/llvm-project/lld/MachO/ConcatOutputSection.cpp:361:11
>     #3 0x5652c20563b5 in operator() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:68:12
>     #4 0x5652c20563b5 in operator() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:242:11
>     #5 0x5652c20563b5 in __invoke<(lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:240:16) &> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__type_traits/invoke.h:150:25
>     #6 0x5652c20563b5 in __call<(lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:240:16) &> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__type_traits/invoke.h:225:5
>     #7 0x5652c20563b5 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:172:12
>     #8 0x5652c20563b5 in std::__1::__function::__func<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_0, std::__1::allocator<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_0>, void ()>::operator()() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:314:10
>     #9 0x5652c2056164 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:431:12
>     #10 0x5652c2056164 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:990:10
>     #11 0x5652c2056164 in operator() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:214:11
>     #12 0x5652c2056164 in __invoke<(lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:213:9) &> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__type_traits/invoke.h:150:25
>     #13 0x5652c2056164 in __call<(lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:213:9) &> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__type_traits/invoke.h:225:5
>     #14 0x5652c2056164 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:172:12
>     #15 0x5652c2056164 in std::__1::__function::__func<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0, std::__1::allocator<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0>, void ()>::operator()() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:314:10
>     #16 0x5652c204fe99 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:431:12
>     #17 0x5652c204fe99 in operator() /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__functional/function.h:990:10
>     #18 0x5652c204fe99 in llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:141:7
>     #19 0x5652c2050414 in operator() /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:64:36
>     #20 0x5652c2050414 in __invoke<(lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:64:30)> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__type_traits/invoke.h:150:25
>     #21 0x5652c2050414 in __thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, (lambda at /b/sanitizer-x86_64-linux-fast/build/llvm-project/llvm/lib/Support/Parallel.cpp:64:30)> /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__thread/thread.h:193:3
>     #22 0x5652c2050414 in void* std::__1::__thread_proxy[abi:nn190000]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::ThreadPoolExecutor(llvm::ThreadPoolStrategy)::'lambda'()::operator()() const::'lambda'()>>(void*) /b/sanitizer-x86_64-linux-fast/build/libcxx_build_asan_ubsan/include/c++/v1/__thread/thread.h:202:3
>     #23 0x5652c1d32058 in asan_thread_start(void*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:239:28
>     #24 0x7f86a5c97b59  (/lib/x86_64-linux-gnu/libc.so.6+0x97b59) (BuildId: 6a981b07a3731293c24c10a21397416d3c3d52ed)
>     #25 0x7f86a5d285fb  (/lib/x86_64-linux-gnu/libc.so.6+0x1285fb) (BuildId: 6a981b07a3731293c24c10a21397416d3c3d52ed)
> Address 0x7f86a1c54c78 is located in stack of thread T0 at offset 120 in frame
>     #0 0x5652c2a30fff in (anonymous namespace)::ObjcCategoryMerger::doMerge() /b/sanitizer-x86_64-linux-fast/build/llvm-project/lld/MachO/ObjC.cpp:1265
> ```

Thanks for pointing this out, I'll forward fix ASAP or revert later today. 

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


More information about the llvm-commits mailing list