Skip to content

fix(arm32): widen MinidumpContextARM::fpscr to uint64_t#150

Closed
jpnurmi wants to merge 2 commits into
getsentryfrom
jpnurmi/fix/arm32-fpscr
Closed

fix(arm32): widen MinidumpContextARM::fpscr to uint64_t#150
jpnurmi wants to merge 2 commits into
getsentryfrom
jpnurmi/fix/arm32-fpscr

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

MinidumpContextARM::fpscr was declared as uint32_t, making the struct 364 bytes on disk. Other downstream readers of the ARM32 minidump context stream — breakpad's MDRawContextARM, rust-minidump's CONTEXT_ARM, the Sentry ingest path that uses rust-minidump — treat fpscr as uint64_t and expect a 368-byte struct, so crashpad's output was 4 bytes short and couldn't be fully deserialized.

The comment above the struct already noted that extra[8] is "included for compatibility with breakpad"; fpscr's width was the remaining divergence. Switch it to uint64_t so sizeof(MinidumpContextARM) == 368, matching breakpad / rust-minidump.

See also:

MinidumpContextARM::fpscr was declared as uint32_t, making the struct
364 bytes on disk. Every other downstream reader of the ARM32 minidump
context stream — breakpad's MDRawContextARM, rust-minidump's
CONTEXT_ARM, the Sentry ingest path that uses rust-minidump — treats
fpscr as uint64_t and expects a 368-byte struct, so crashpad's output
was 4 bytes short and couldn't be fully deserialized.

The comment above the struct already noted that extra[8] is
"included for compatibility with breakpad"; fpscr's width was the
remaining divergence. Switch it to uint64_t so sizeof(MinidumpContextARM)
== 368, matching breakpad / rust-minidump.

rust-minidump's struct at a pinned SHA, for reference:

  https://github.com/rust-minidump/rust-minidump/blob/d4fefc765aad35b3bef569d53c1680eadab5a268/minidump-common/src/format.rs#L1034-L1055

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After widening MinidumpContextARM::fpscr to uint64_t to match
breakpad's on-disk layout, the in-memory CPUContextARM::vfp_regs.fpscr
is still uint32_t (the ARM FPSCR register is genuinely 32 bits; the
u64 in the minidump stream is padding for alignment, not extra data).
Add an explicit static_cast to silence MSVC's /WX narrowing warning.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
context_.arm->pc = src->pc;
context_.arm->cpsr = src->cpsr;
context_.arm->vfp_regs.fpscr = src->fpscr;
context_.arm->vfp_regs.fpscr = static_cast<uint32_t>(src->fpscr);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This makes me feel that Crashpad is actually right and we should fix Breakpad and rust-minidump instead...

@jpnurmi

jpnurmi commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator Author

I assumed MinidumpContextARM was 364 bytes based on its field declarations, but the compiler already inserts 4 bytes of padding after the uint32_t fpscr to align the following uint64_t vfp[32], so sizeof(MinidumpContextARM) == 368 — wire-identical to breakpad's MDRawContextARM and rust-minidump's CONTEXT_ARM. The bytes at offsets 76–79 are zero-initialized compiler padding here and the upper half of fpscr there — either way the on-disk stream matches.

Verified with a quick sizeof/offsetof check:

CrashpadOrig: size=368 fpscr@72 vfp@80 extra@336
CrashpadFixed: size=368 fpscr@72 vfp@80 extra@336

No change needed.

@jpnurmi jpnurmi closed this Apr 21, 2026
@jpnurmi jpnurmi deleted the jpnurmi/fix/arm32-fpscr branch April 21, 2026 11:39
jpnurmi added a commit to getsentry/sentry-native that referenced this pull request Apr 21, 2026
See also: getsentry/crashpad#150

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant