[llvm-bugs] [Bug 48146] New: exitLld() deallocates MemoryBuffer which may back a section name being concurrently accessed by another thread

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 10 16:46:33 PST 2020


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

            Bug ID: 48146
           Summary: exitLld() deallocates MemoryBuffer which may back a
                    section name being concurrently accessed by another
                    thread
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: ELF
          Assignee: unassignedbugs at nondot.org
          Reporter: i at maskray.me
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com

The issue of low priority as it happens after the error limit is reached
so there is no loss of diagnostics.

When linking one executable, I observe that thread 1 and thread 6 are running
`parallelForEachN` code in `OutputSection::writeTo` (for the output section
`.text`) and are both reporting a relocation out-of-range error.

thread 6 emits an error and calls `exitLld` (since the error limit is reached)
which calls:
```
llvm::sys::Process::Exit(val)
SpecificBumpPtrAllocator<lld::elf::SymbolTable>::~SpecificBumpPtrAllocator
SpecificBumpPtrAllocator<lld::elf::SymbolTable>::DestroyAll
// The MemoryBuffer backing the section name accessed by thread 1 has been
deallocated
```

thread 1 is calling `InputSectionBase::getLocation` and fails because the
section name it is accessing has been deallocated by thread 6.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201111/21ccea30/attachment.html>


More information about the llvm-bugs mailing list