Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jan 2022 19:18:34 -0800
From:      Mark Millard <marklmi@yahoo.com>
To:        freebsd-current <freebsd-current@freebsd.org>
Subject:   main [so: 14] lld got a: ERROR: AddressSanitizer: use-after-poison on address 0x621002402688
Message-ID:  <C5350F6A-15E9-4600-8E06-FB49CC367BAC@yahoo.com>
References:  <C5350F6A-15E9-4600-8E06-FB49CC367BAC.ref@yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
It will probably be some time before I get to trying to have a
simpler context, but here is some information, including related
backtraces:

. . .
 "/usr/bin/ld.lld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 =
--hash-style=3Dboth --enable-new-dtags -o =
../cpp_clockinfo_main-ThreadRipper1950X-131072MiB-threads_32-LP64-FreeBSD_=
main_n247756_348c41d1815d_64bit-clang++_13_O3lto-libc++-xSAN =
/usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib =
-plugin-opt=3Dmcpu=3Dx86-64 -plugin-opt=3DO3 --whole-archive =
/usr/lib/clang/13.0.0/lib/freebsd/libclang_rt.asan-x86_64.a =
--no-whole-archive --whole-archive =
/usr/lib/clang/13.0.0/lib/freebsd/libclang_rt.asan_cxx-x86_64.a =
--no-whole-archive --export-dynamic =
../objs/cpp_thousandslocale-clang++_13_O3lto-libc++-xSAN.o =
../objs/cpp_clockinfo-clang++_13_O3lto-libc++-xSAN.o =
/tmp/cpp_clockinfo_main-3fa732.o -lc++ -lm --no-as-needed -lpthread -lrt =
-lm -lexecinfo -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc =
-lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o =
/usr/lib/crtn.o
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D48532=3D=3DERROR: AddressSanitizer: use-after-poison on address =
0x621002402688 at pc 0x000002145504 bp 0x7fffffff9880 sp 0x7fffffff9040
READ of size 8 at 0x621002402688 thread T0
    #0 0x2145503 in memcpy =
/usr/main-src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/saniti=
zer_common_interceptors.inc:827:5
    #1 0x33e77d9 in uninitialized_copy<llvm::MachineMemOperand *const, =
llvm::MachineMemOperand *> =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h:505=
:7
    #2 0x33e77d9 in append<llvm::MachineMemOperand *const *, void> =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h:652=
:5
    #3 0x33e77d9 in =
llvm::MachineInstr::cloneMergedMemRefs(llvm::MachineFunction&, =
llvm::ArrayRef<llvm::MachineInstr const*>) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/MachineInstr.cpp:448:1=
4
    #4 0x34c936c in mergeOperations =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:792:=
19
    #5 0x34c936c in llvm::BranchFolder::mergeCommonTails(unsigned int) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:815:=
7
    #6 0x34c9d01 in =
llvm::BranchFolder::TryTailMergeBlocks(llvm::MachineBasicBlock*, =
llvm::MachineBasicBlock*, unsigned int) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:974:=
5
    #7 0x34c7869 in =
llvm::BranchFolder::TailMergeBlocks(llvm::MachineFunction&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:1132=
:21
    #8 0x34c6b15 in =
llvm::BranchFolder::OptimizeFunction(llvm::MachineFunction&, =
llvm::TargetInstrInfo const*, llvm::TargetRegisterInfo const*, =
llvm::MachineLoopInfo*, bool) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:204:=
34
    #9 0x34cd7ff in (anonymous =
namespace)::BranchFolderPass::runOnMachineFunction(llvm::MachineFunction&)=
 =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/BranchFolding.cpp:133:=
17
    #10 0x33ce97d in =
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cp=
p:72:13
    #11 0x2ed4382 in llvm::FPPassManager::runOnFunction(llvm::Function&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1439:=
27
    #12 0x2eda342 in llvm::FPPassManager::runOnModule(llvm::Module&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:=
16
    #13 0x2ed4a08 in runOnModule =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1554:=
27
    #14 0x2ed4a08 in llvm::legacy::PassManagerImpl::run(llvm::Module&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:542:4=
4
    #15 0x2fbb8d8 in codegen(llvm::lto::Config const&, =
llvm::TargetMachine*, =
std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTOBackend.cpp:416:17
    #16 0x2fbab37 in llvm::lto::backend(llvm::lto::Config const&, =
std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTOBackend.cpp:515:5
    #17 0x2f2d3db in =
llvm::lto::LTO::runRegularLTO(std::__1::function<std::__1::unique_ptr<llvm=
::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>) /usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTO.cpp:1134:13
    #18 0x2f2c7a5 in =
llvm::lto::LTO::run(std::__1::function<std::__1::unique_ptr<llvm::lto::Nat=
iveObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> =
> (unsigned int)>, =
std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::Nati=
veObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> =
> (unsigned int)> (unsigned int, llvm::StringRef)>) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTO.cpp:1033:18
    #19 0x25aa570 in lld::elf::BitcodeCompiler::compile() =
/usr/main-src/contrib/llvm-project/lld/ELF/LTO.cpp:316:24
    #20 0x2382c4a in void =
lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::s=
upport::endianness)1, true> >() =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:1986:31
    #21 0x22fe9c9 in void =
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endiann=
ess)1, true> >(llvm::opt::InputArgList&) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:2321:3
    #22 0x22db283 in =
lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:564:7
    #23 0x22d9f15 in lld::elf::link(llvm::ArrayRef<char const*>, bool, =
llvm::raw_ostream&, llvm::raw_ostream&) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:122:11
    #24 0x2b28651 in lldMain(int, char const**, llvm::raw_ostream&, =
llvm::raw_ostream&, bool) =
/usr/main-src/contrib/llvm-project/lld/tools/lld/lld.cpp:146:11
    #25 0x2b28073 in main =
/usr/main-src/contrib/llvm-project/lld/tools/lld/lld.cpp:211:12

0x621002402688 is located 3464 bytes inside of 4096-byte region =
[0x621002401900,0x621002402900)
allocated by thread T0 here:
    #0 0x21adead in operator new(unsigned long) =
/usr/main-src/contrib/llvm-project/compiler-rt/lib/asan/asan_new_delete.cp=
p:95:3
    #1 0x2218a27 in Allocate =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/Support/AllocatorBase=
.h:85:12
    #2 0x2218a27 in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, =
4096ul, 4096ul, 128ul>::StartNewSlab() =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:3=
35:21
    #3 0x221873e in llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, =
4096ul, 4096ul, 128ul>::Allocate(unsigned long, llvm::Align) =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:1=
90:5
    #4 0x33e695a in Allocate =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/Support/Allocator.h:2=
04:12
    #5 0x33e695a in =
allocate<llvm::BumpPtrAllocatorImpl<llvm::MallocAllocator, 4096, 4096, =
128> > =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/Support/ArrayRecycler=
.h:130:38
    #6 0x33e695a in allocateOperandArray =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineFuncti=
on.h:960:28
    #7 0x33e695a in =
llvm::MachineInstr::MachineInstr(llvm::MachineFunction&, =
llvm::MCInstrDesc const&, llvm::DebugLoc, bool) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/MachineInstr.cpp:127:1=
9
    #8 0x33d4f9e in =
llvm::MachineFunction::CreateMachineInstr(llvm::MCInstrDesc const&, =
llvm::DebugLoc const&, bool) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/MachineFunction.cpp:35=
2:7
    #9 0x39baa6d in BuildMI =
/usr/main-src/contrib/llvm-project/llvm/include/llvm/CodeGen/MachineInstrB=
uilder.h:349:25
    #10 0x39baa6d in llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode*, =
bool, bool, llvm::DenseMap<llvm::SDValue, llvm::Register, =
llvm::DenseMapInfo<llvm::SDValue>, =
llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register> >&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmit=
ter.cpp:1165:5
    #11 0x39b2e35 in EmitNode =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmit=
ter.h:145:7
    #12 0x39b2e35 in =
llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<ll=
vm::MachineInstr, false>&)::$_1::operator()(llvm::SDNode*, bool, bool, =
llvm::DenseMap<llvm::SDValue, llvm::Register, =
llvm::DenseMapInfo<llvm::SDValue>, =
llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register> >&) const =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleD=
AGSDNodes.cpp:872:13
    #13 0x39b248f in =
llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<ll=
vm::MachineInstr, false>&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/ScheduleD=
AGSDNodes.cpp:936:22
    #14 0x399c06e in llvm::SelectionDAGISel::CodeGenAndEmitDAG() =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/Selection=
DAGISel.cpp:1006:42
    #15 0x399b447 in =
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/Selection=
DAGISel.cpp:1622:7
    #16 0x3998efd in =
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/Selection=
DAGISel.cpp:509:3
    #17 0x41c35a5 in (anonymous =
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) =
/usr/main-src/contrib/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp=
:193:25
    #18 0x33ce97d in =
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) =
/usr/main-src/contrib/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cp=
p:72:13
    #19 0x2ed4382 in llvm::FPPassManager::runOnFunction(llvm::Function&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1439:=
27
    #20 0x2eda342 in llvm::FPPassManager::runOnModule(llvm::Module&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1485:=
16
    #21 0x2ed4a08 in runOnModule =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1554:=
27
    #22 0x2ed4a08 in llvm::legacy::PassManagerImpl::run(llvm::Module&) =
/usr/main-src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:542:4=
4
    #23 0x2fbb8d8 in codegen(llvm::lto::Config const&, =
llvm::TargetMachine*, =
std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTOBackend.cpp:416:17
    #24 0x2fbab37 in llvm::lto::backend(llvm::lto::Config const&, =
std::__1::function<std::__1::unique_ptr<llvm::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTOBackend.cpp:515:5
    #25 0x2f2d3db in =
llvm::lto::LTO::runRegularLTO(std::__1::function<std::__1::unique_ptr<llvm=
::lto::NativeObjectStream, =
std::__1::default_delete<llvm::lto::NativeObjectStream> > (unsigned =
int)>) /usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTO.cpp:1134:13
    #26 0x2f2c7a5 in =
llvm::lto::LTO::run(std::__1::function<std::__1::unique_ptr<llvm::lto::Nat=
iveObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> =
> (unsigned int)>, =
std::__1::function<std::__1::function<std::__1::unique_ptr<llvm::lto::Nati=
veObjectStream, std::__1::default_delete<llvm::lto::NativeObjectStream> =
> (unsigned int)> (unsigned int, llvm::StringRef)>) =
/usr/main-src/contrib/llvm-project/llvm/lib/LTO/LTO.cpp:1033:18
    #27 0x25aa570 in lld::elf::BitcodeCompiler::compile() =
/usr/main-src/contrib/llvm-project/lld/ELF/LTO.cpp:316:24
    #28 0x2382c4a in void =
lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::s=
upport::endianness)1, true> >() =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:1986:31
    #29 0x22fe9c9 in void =
lld::elf::LinkerDriver::link<llvm::object::ELFType<(llvm::support::endiann=
ess)1, true> >(llvm::opt::InputArgList&) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:2321:3
    #30 0x22db283 in =
lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:564:7
    #31 0x22d9f15 in lld::elf::link(llvm::ArrayRef<char const*>, bool, =
llvm::raw_ostream&, llvm::raw_ostream&) =
/usr/main-src/contrib/llvm-project/lld/ELF/Driver.cpp:122:11
    #32 0x2b28651 in lldMain(int, char const**, llvm::raw_ostream&, =
llvm::raw_ostream&, bool) =
/usr/main-src/contrib/llvm-project/lld/tools/lld/lld.cpp:146:11
    #33 0x2b28073 in main =
/usr/main-src/contrib/llvm-project/lld/tools/lld/lld.cpp:211:12
    #34 0x212ea5f in _start /usr/main-src/lib/csu/amd64/crt1_c.c:73:7
    #35 0x805007007  (<unknown module>)

SUMMARY: AddressSanitizer: use-after-poison =
/usr/main-src/contrib/llvm-project/compiler-rt/lib/sanitizer_common/saniti=
zer_common_interceptors.inc:827:5 in memcpy
Shadow bytes around the buggy address:
  0x4c4200480480: f7 f7 f7 f7 f7 f7 00 00 00 00 00 00 00 00 00 00
  0x4c4200480490: 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7
  0x4c42004804a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x4c42004804b0: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 00 00 00 00 00 00
  0x4c42004804c0: 00 00 00 00 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7
=3D>0x4c42004804d0: f7[f7]f7 f7 00 00 00 00 00 00 00 00 00 00 00 00
  0x4c42004804e0: 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 00 00
  0x4c42004804f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f7 f7
  0x4c4200480500: f7 f7 f7 f7 f7 f7 f7 f7 00 00 00 00 00 00 00 00
  0x4c4200480510: 00 00 00 00 00 00 00 00 f7 f7 f7 f7 f7 f7 f7 f7
  0x4c4200480520: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07=20
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
=3D=3D48532=3D=3DABORTING
clang++: error: linker command failed with exit code 1 (use -v to see =
invocation)


For reference:

The context is a used-for-chroot installation of a WITH_ASAN=3D =
WITH_UBSAN=3D
build world.

# uname -apKU
FreeBSD amd64_ZFS 14.0-CURRENT FreeBSD 14.0-CURRENT #30
main-n252475-e76c0108990b-dirty: Sat Jan 15 21:18:14 PST 2022
=
root@amd64_ZFS:/usr/obj/BUILDs/main-amd64-nodbg-clang/usr/main-src/amd64.a=
md64/sys/GENERIC-NODBG
amd64 amd64 1400047 1400047

# ~/fbsd-based-on-what-commit.sh -C /usr/main-src/
branch: main
merge-base: e76c0108990b52a25f548cba4c0f1b8db59c6b8b
merge-base: CommitDate: 2022-01-16 00:32:36 +0000
e76c0108990b (HEAD -> main, freebsd/main, freebsd/HEAD) Fix inverse =
sleep logic in buf_daemon().
n252475 (--first-parent --count for merge-base)


=3D=3D=3D
Mark Millard
marklmi at yahoo.com




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C5350F6A-15E9-4600-8E06-FB49CC367BAC>