Skip to content

Fix cDAC dump tests on 32-bit ARM targets#125841

Merged
max-charlamb merged 1 commit intomainfrom
dev/max-charlamb/runtime-cdac-arm-investigation
Mar 20, 2026
Merged

Fix cDAC dump tests on 32-bit ARM targets#125841
max-charlamb merged 1 commit intomainfrom
dev/max-charlamb/runtime-cdac-arm-investigation

Conversation

@max-charlamb
Copy link
Copy Markdown
Member

Summary

Work around a ClrMD bug (microsoft/clrmd#1407) that causes ModuleInfo.GetExportSymbolAddress() to return corrupt addresses for 32-bit ELF modules, breaking all cDAC dump tests on ARM32.

Problem

ClrMD's ElfSymbol32 struct declares its Value field as ulong (8 bytes) instead of uint (4 bytes), mismatching the ELF32 spec's 4-byte st_value. This causes the adjacent st_size field to leak into the upper 32 bits of the symbol value. For example, the DotNetRuntimeContractDescriptor export (32 bytes, st_size = 0x20) produces:

Expected address: 0xEFCE9BA8
Actual address:   0x20EFCE9BA8  (0x20 = st_size in upper bits)

All memory reads at the returned address fail because it is outside the 32-bit address space.

Fix

Mask the address returned by GetExportSymbolAddress() to 32 bits when the target pointer size is 4:

if (_dataTarget.DataReader.PointerSize == 4)
    address &= 0xFFFF_FFFF;

This workaround can be removed once microsoft/clrmd#1407 is fixed upstream.

Validation

  • All 103 cDAC dump tests pass against linux-arm32 crash dumps (90 passed, 13 skipped for platform-specific tests)
  • All 1274 cDAC unit tests pass

ClrMdDumpHost: Mask export addresses to 32-bit on 32-bit targets.
ClrMD's GetExportSymbolAddress() returns addresses with spurious
upper bits on ARM32 ELF modules, causing all dump tests to fail
with 'Failed to create ContractDescriptorTarget'.

See microsoft/clrmd#1407

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the cDAC dump-test hosting logic to work around a ClrMD symbol-resolution bug that returns corrupted export addresses for 32-bit ELF modules (notably linux-arm32), causing dump-based tests to fail.

Changes:

  • Mask the export symbol address to 32 bits when the target pointer size is 4, preventing invalid out-of-range addresses on 32-bit targets.
  • Add an inline comment explaining the ClrMD issue and linking the upstream tracking bug.

@max-charlamb max-charlamb merged commit 4c7d197 into main Mar 20, 2026
58 checks passed
@max-charlamb max-charlamb deleted the dev/max-charlamb/runtime-cdac-arm-investigation branch March 20, 2026 18:51
max-charlamb added a commit that referenced this pull request Mar 25, 2026
Adds 32-bit platform coverage to the cDAC dump test Helix
infrastructure:

- **windows\_x86**: Runs on `Windows.11.Amd64.Client.Open` via WoW64
(same queue as x64)
- **linux\_arm**: Runs on containerized ARM32 Helix queue
(`helix_linux_arm32_oldest` — Debian on ARM64 hardware)

Depends on #125841 which fixes cDAC dump tests on 32-bit ARM targets.

### Changes
- `eng/pipelines/cdac/prepare-cdac-helix-steps.yml`: Added queue switch
cases for `windows_x86` and `linux_arm`
- `eng/pipelines/runtime-diagnostics.yml`: Added `linux_arm` and
`windows_x86` to `cdacDumpPlatforms` defaults, publish dump artifacts on
test failure
- `src/native/managed/cdac/tests/DumpTests/EnableUnsignedDac.props`:
Extracted shared unsigned DAC registry logic with WoW64 `/reg:32`
support for x86
- `src/native/managed/cdac/tests/DumpTests/cdac-dump-helix.proj`:
Preserve test exit code through tar command, import shared DAC props

### Testing
CI validates all 6 platforms: windows\_x64, windows\_x86,
windows\_arm64, linux\_x64, linux\_arm64, linux\_arm.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants