Skip to content

diag(crash): name the library + offset a userspace SIGSEGV faults in - #745

Merged
Pryancito merged 1 commit into
masterfrom
claude/labwc-eclipse-desktop-08f1ft
Aug 5, 2026
Merged

diag(crash): name the library + offset a userspace SIGSEGV faults in#745
Pryancito merged 1 commit into
masterfrom
claude/labwc-eclipse-desktop-08f1ft

Conversation

@Pryancito

Copy link
Copy Markdown
Owner

A dynamically-linked crash (labwc and its libraries) left only unhandled page fault @ … pc=0x7f… plus a Done(139) — the PC is an absolute address with no indication of which mapping it belongs to, so it could not be symbolised. Add VmAddressRegion::describe_addr, which locates the mapping containing an address and returns its base, the byte offset into the backing file (VMO), and the backing object's name (a file path for a file mapping, already set by the file get_vmo path; empty for anonymous memory).

The SIGSEGV handler now prints, for both the faulting PC and the bad data address:

[crash] pid=N pc 0x7f… in /usr/lib/libwlroots.so.13 + 0x1234 (map base 0x7f…)

so the exact fault can be located offline with addr2line -e <file> 0x<off> / objdump, turning an opaque compositor Done(139) into a pinned crash site. Anonymous mappings (heap/stack/JIT) print as [anon] + off.

Claude-Session: https://claude.ai/code/session_01MHCn5RNRcwR5PY1sYBHY2S

A dynamically-linked crash (labwc and its libraries) left only
`unhandled page fault @ … pc=0x7f…` plus a `Done(139)` — the PC is an absolute
address with no indication of which mapping it belongs to, so it could not be
symbolised. Add `VmAddressRegion::describe_addr`, which locates the mapping
containing an address and returns its base, the byte offset into the backing
file (VMO), and the backing object's name (a file path for a file mapping,
already set by the file get_vmo path; empty for anonymous memory).

The SIGSEGV handler now prints, for both the faulting PC and the bad data
address:

  [crash] pid=N pc 0x7f… in /usr/lib/libwlroots.so.13 + 0x1234 (map base 0x7f…)

so the exact fault can be located offline with `addr2line -e <file> 0x<off>` /
`objdump`, turning an opaque compositor `Done(139)` into a pinned crash site.
Anonymous mappings (heap/stack/JIT) print as `[anon] + off`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHCn5RNRcwR5PY1sYBHY2S
Copilot AI lite review requested due to automatic review settings August 5, 2026 22:50
@Pryancito
Pryancito merged commit 17790e6 into master Aug 5, 2026
2 of 14 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

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 improves userspace crash diagnostics by resolving faulting addresses (PC and fault address) to the owning VM mapping, including mapping base, offset into the backing VMO/file, and the backing object name, so dynamically-linked crashes can be symbolized offline.

Changes:

  • Add VmAddressRegion::describe_addr to locate the mapping containing a virtual address and return (base, offset, name).
  • Extend the userspace SIGSEGV/page-fault path to log the resolved library/anon mapping and offset for both pc and the fault address.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
zircon-object/src/vm/vmar.rs Adds describe_addr helper to map an address to its mapping base, VMO/file offset, and object name.
loader/src/linux.rs Logs resolved mapping information for crash PC and fault address to enable offline symbolization.
Suppressed comments (1)

zircon-object/src/vm/vmar.rs:1531

  • file_off is computed with saturating_sub, which can silently produce an incorrect offset (e.g., if invariants are ever violated and vaddr < inner.addr, this would report the mapping start instead of failing). Since this method already returns Option, prefer checked_sub/checked_add and return None on underflow/overflow to avoid misleading crash diagnostics.
        // File offset of `vaddr`: the VMO offset the mapping starts at plus how
        // far `vaddr` is into the mapping.
        let file_off = inner.vmo_offset + vaddr.saturating_sub(inner.addr);
        Some((inner.addr, file_off, map.vmo.name()))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1525 to +1527
pub fn describe_addr(&self, vaddr: usize) -> Option<(VirtAddr, usize, alloc::string::String)> {
let map = self.find_mapping(vaddr)?;
let inner = map.inner.lock();
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.

3 participants