Issue 245065
Summary [fuzzer-found] [BOLT] SIGSEGV in parseLSDA when processing a .NET 10 Native AOT ELF
Labels BOLT
Assignees
Reporter Gladskih
    ## Description

`llvm-bolt` segfaults when processing a Linux x86-64 PIE produced by .NET 10 Native AOT. The smallest source case I verified consists of `return 0;`. The input executable exits successfully. BOLT exits with status `139` both with and without `--instrument`.

## Reproduction steps

On Linux x86-64, install the [.NET Native AOT build prerequisites](https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/) and put `llvm-bolt` on `PATH`. Save the following two files in the same directory.

`Program.cs`

```csharp
return 0;
```

`Repro.csproj`

```xml
<Project Sdk="Microsoft.NET.Sdk">
 <PropertyGroup>
    <OutputType>Exe</OutputType>
 <TargetFramework>net10.0</TargetFramework>
 <PublishAot>true</PublishAot>
    <StripSymbols>false</StripSymbols>
 <InvariantGlobalization>true</InvariantGlobalization>
  </PropertyGroup>
 <ItemGroup>
    <ExtraLinkerArg Include="--emit-relocs" />
 </ItemGroup>
</Project>
```

Run these commands from that directory in a shell without `errexit`.

```sh
work=$(mktemp -d)
dotnet publish Repro.csproj -c Release -r linux-x64 -o "$work/publish"
strip --strip-debug -o "$work/Repro" "$work/publish/Repro"
"$work/Repro"
echo "Application exit status: $?"
ulimit -c 0
llvm-bolt "$work/Repro" -o "$work/Repro.bolted"
echo "BOLT exit status: $?"
```

The input has both `.symtab` and `.rela.text`.

## Actual behavior

The application exits with status `0`. BOLT exits with `SIGSEGV` (status `139`) during disassembly. In the Ubuntu 22.1.2 build, the first two BOLT frames after the signal handler symbolized as follows using the matching `bolt-22-dbgsym` package. Build-path prefixes are omitted.

```text
llvm::bolt::BinaryFunction::parseLSDA(llvm::ArrayRef<unsigned char>, unsigned long)
  inlined frame at bolt/lib/Core/Exceptions.cpp:207
llvm::bolt::RewriteInstance::disassembleFunctions()
 at bolt/lib/Rewrite/RewriteInstance.cpp:3751
```

## Expected behavior

BOLT should either process the executable successfully or exit with a diagnostic explaining which input feature it cannot handle.

## Configuration

- Ubuntu 26.04 LTS under WSL2, x86-64
- .NET SDK 10.0.114, ILCompiler 10.0.14, Clang 21.1.8, GNU ld 2.46
- BOLT 22.1.2 from Ubuntu
- BOLT 23.1.6 (`5b10d2d74929`) and a 24.0.0 development snapshot (`51d7f08b16b6`) from apt.llvm.org

All three BOLT builds exited with status `139` for this sample, both with and without `--instrument`.

## Supplementary material

- [Source files and experiment notes](https://github.com/Gladskih/native-aot-llvm-bolt)
- #73992 also includes a `parseLSDA` frame for a C++ executable. The two failures have not been established to share a cause.

OpenAI Codex assisted with reducing the case to the one-line C# project, running the reproduction and editing this report. The ELF is generated by the stock .NET Native AOT toolchain using the source above.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to