https://llvm.org/bugs/show_bug.cgi?id=30227

            Bug ID: 30227
           Summary: RelativeRel is used, but not initialized for AMDGPU
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: ELF
          Assignee: unassignedb...@nondot.org
          Reporter: kra...@google.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

As of now, MemorySanitizer bots are red, because Target->RelativeRel is used
but not initialized for AMDGPU arch:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15968

==28645==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7b66c5 in
lld::elf::RelocationSection<llvm::object::ELFType<(llvm::support::endianness)1,
true>
>::addReloc(lld::elf::DynamicReloc<llvm::object::ELFType<(llvm::support::endianness)1,
true> > const&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/OutputSections.cpp:357:7
    #1 0x9c38e4 in operator()
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Relocations.cpp:532:25
    #2 0x9c38e4 in
scanRelocs<llvm::object::ELFType<llvm::support::endianness::little, true>,
llvm::object::Elf_Rel_Impl<llvm::object::ELFType<llvm::support::endianness::little,
true>, true> >
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Relocations.cpp:683
    #3 0x9c38e4 in void
lld::elf::scanRelocations<llvm::object::ELFType<(llvm::support::endianness)1,
true>
>(lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >&, llvm::object::ELFType<(llvm::support::endianness)1, true>::Shdr
const&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Relocations.cpp:696
    #4 0x96157c in operator()
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/libcxx_build_msan/include/c++/v1/functional:1897:12
    #5 0x96157c in (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
>::forEachRelSec(std::__1::function<void
(lld::elf::InputSectionBase<llvm::object::ELFType<(llvm::support::endianness)1,
true> >&,
llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<(llvm::support::endianness)1,
true> > const&)>)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Writer.cpp:666
    #6 0x938123 in finalizeSections
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Writer.cpp:735:3
    #7 0x938123 in (anonymous
namespace)::Writer<llvm::object::ELFType<(llvm::support::endianness)1, true>
>::run()
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Writer.cpp:260
    #8 0x93382d in void
lld::elf::writeResult<llvm::object::ELFType<(llvm::support::endianness)1, true>
>()
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Writer.cpp:228:18
    #9 0x632244 in void
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endianness)1,
true> >(llvm::opt::InputArgList&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Driver.cpp:645:3
    #10 0x61e3ec in lld::elf::LinkerDriver::main(llvm::ArrayRef<char const*>)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Driver.cpp:308:5
    #11 0x61ba32 in lld::elf::link(llvm::ArrayRef<char const*>,
llvm::raw_ostream&)
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/Driver.cpp:52:11
    #12 0x54d8ee in main
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/tools/lld/lld.cpp:106:13
    #13 0x7f96a4537f44 in __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21f44)
    #14 0x4ca136 in _start
(/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/lld+0x4ca136)

SUMMARY: MemorySanitizer: use-of-uninitialized-value
/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/lld/ELF/OutputSections.cpp:357:7
in
lld::elf::RelocationSection<llvm::object::ELFType<(llvm::support::endianness)1,
true>
>::addReloc(lld::elf::DynamicReloc<llvm::object::ELFType<(llvm::support::endianness)1,
true> > const&)

The detected use was added in https://reviews.llvm.org/rL280210 but it's just
the CL that exposed the issue, not the one that created it. In fact, we have
more uses of RelativeRel in the code base, they just don't run for AMDGPU under
MemorySanitizer => they are not detected.

We should either don't use this field on AMDGPU, or initialize it to a sane
value.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to