Skip to content

feat(symbols): fall back to a module's export table when no PDB is available - #36

Merged
dmaivel merged 1 commit into
dmaivel:masterfrom
elmarco:symbols-export-fallback
Oct 21, 2026
Merged

dmaivel merged 1 commit into
dmaivel:masterfrom
elmarco:symbols-export-fallback

Conversation

@elmarco

@elmarco elmarco commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

A module whose PDB no symbol source has — a vendor driver never published, a repro build that exists only on the crashed machine — indexed nothing: k, ln and !analyze showed module+offset for its frames, while the Windows debugger names functions from the image's export table in the same situation (Symbol file: myfault.sys).

The export directory of such a module's mapped image is read while guest memory is reachable from the loading thread, and the named exports are indexed under the identity the module's CodeView record gives whenever its PDB cannot be acquired — remembered unavailable, download failed, or indexing failed. Ordinal-only exports and forwarders are skipped. A PDB indexed later under the same identity replaces the export symbols, and the fallback never overwrites an indexed PDB.

Reading the exports at plan time (not at the failure) is what lets the background fetch thread publish them too: guest memory is only usable from the thread that owns a KD transport, so the exports are stashed on the load and the completion half stays files-and-network only.

Verified

A libvirt-written kernel dump of a NotMyFault 0xD1 crash (myfault.sys, whose PDB is published nowhere):

Before After
ln <faulting RIP> myfault+0x1e35 myfault!nmf_fault_irql+0x35 — the same symbol the Windows debugger reports for this dump
!analyze fault myfault+0x1e35 myfault!nmf_fault_irql+0x35
failure signature bugcheck:000000d1|module:myfault bugcheck:000000d1|symbol:myfault!nmf_fault_irql
stack frame myfault+0x1530 myfault!DriverEntry+0x530

A driver with neither exports nor an obtainable PDB still shows module+offset; that needs the PDB itself (--sympath-append covers a virtio-win ISO layout, for instance).

cargo test (1241 tests, including a new unit test for the fallback and its yield-to-PDB rule), cargo clippy --all-targets and cargo fmt --check pass.

A module whose PDB no symbol source has — a vendor driver never
published — indexed nothing, so k, ln and !analyze showed module+offset
for its frames while the Windows debugger named functions from the
image's export table in the same situation.

Read the export directory of such a module's mapped image while guest
memory is reachable from the loading thread, and index the named exports
under the identity its CodeView record gives when the PDB cannot be
acquired. A PDB indexed later under the same identity replaces the
export symbols.
@dmaivel
dmaivel merged commit 59593d3 into dmaivel:master Oct 21, 2026
21 checks passed
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.

2 participants