<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - exitLld() deallocates MemoryBuffer which may back a section name being concurrently accessed by another thread"
   href="https://bugs.llvm.org/show_bug.cgi?id=48146">48146</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>exitLld() deallocates MemoryBuffer which may back a section name being concurrently accessed by another thread
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>i@maskray.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, smithp352@googlemail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>