[PR #1772] windows-boot: recover private stacks for manually mapped images #1785

Open
opened 2026-11-26 21:18:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1772
Author: @sodove
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: feat/windows-boot-mapped-image-stack


📝 Commits (1)

  • 056e682 windows-boot: recover private stacks for manually mapped images

📊 Changes

3 files changed (+540 additions, -0 deletions)

View changed files

📝 scripts/windows-boot/README.md (+30 -0)
➕ scripts/windows-boot/mapped_stack.py (+313 -0)
➕ tests/test_mapped_stack.py (+197 -0)

📄 Description

Claimed in the coordination issue as WIN-BOOT-MAPPED-IMAGE-STACK.

Depends on: #1693 (produces the private exception dump).

What and why

The initial stack can stop inside a PE that the runtime mapped outside the Windows module list. A new offline command takes the private dump and the exact mapped PE. It matches captured instructions to a unique location in an executable section, derives the actual base, and checks for a file-backed x64 unwind entry at the exception RIP. Available header and unwind bytes must agree with the local image.

The tool gives x64 CDB a fixed staging name, disables network symbols and shell commands, selects the saved exception context, and writes the recovered frames to a new private file. Console output contains the outcome and frame count. The Windows boot README documents the command and its limits, including exit-only snapshots and dumps with insufficient instruction bytes.

Tested

  • All eight mapped-stack tests passed on Windows 11 Pro x64. The native CDB test used a hand-built, relocated PE absent from the minidump module list and recovered its caller through the disk unwind table. The synthetic PE was never executed.
  • The tests also cover both minidump memory-list formats, code and header mismatches, duplicate code windows, missing unwind metadata, registered module conflicts, incomplete debugger output, a filename containing debugger command separators, and preservation of an existing report.
  • All three text-writer checks and all 22 report-path tests passed. Python compilation, the no-game-data check on all three changed files, and the whitespace check passed.
  • Verified clean merge trees with main at ed94fbef9 and the current #1693 head.

GPUs tested: n/a (CPU-only synthetic Windows debugging).

AI-assisted: yes

Checklist

  • Based on upstream main and checked for merge conflicts.
  • One topic.
  • No game data, keys or decryption in the change, tests or report.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1772 **Author:** [@sodove](https://github.com/sodove) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/windows-boot-mapped-image-stack` --- ### 📝 Commits (1) - [`056e682`](https://github.com/ubiquitarianism/leonida/commit/056e6823217b5f2a1fd9b2556ba71fd41a757877) windows-boot: recover private stacks for manually mapped images ### 📊 Changes **3 files changed** (+540 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `scripts/windows-boot/README.md` (+30 -0) ➕ `scripts/windows-boot/mapped_stack.py` (+313 -0) ➕ `tests/test_mapped_stack.py` (+197 -0) </details> ### 📄 Description Claimed in the coordination issue as [WIN-BOOT-MAPPED-IMAGE-STACK](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7161231063). Depends on: #1693 (produces the private exception dump). ### What and why The initial stack can stop inside a PE that the runtime mapped outside the Windows module list. A new offline command takes the private dump and the exact mapped PE. It matches captured instructions to a unique location in an executable section, derives the actual base, and checks for a file-backed x64 unwind entry at the exception RIP. Available header and unwind bytes must agree with the local image. The tool gives x64 CDB a fixed staging name, disables network symbols and shell commands, selects the saved exception context, and writes the recovered frames to a new private file. Console output contains the outcome and frame count. The Windows boot README documents the command and its limits, including exit-only snapshots and dumps with insufficient instruction bytes. ### Tested - All eight mapped-stack tests passed on Windows 11 Pro x64. The native CDB test used a hand-built, relocated PE absent from the minidump module list and recovered its caller through the disk unwind table. The synthetic PE was never executed. - The tests also cover both minidump memory-list formats, code and header mismatches, duplicate code windows, missing unwind metadata, registered module conflicts, incomplete debugger output, a filename containing debugger command separators, and preservation of an existing report. - All three text-writer checks and all 22 report-path tests passed. Python compilation, the no-game-data check on all three changed files, and the whitespace check passed. - Verified clean merge trees with main at ed94fbef9 and the current #1693 head. GPUs tested: n/a (CPU-only synthetic Windows debugging). AI-assisted: yes ### Checklist - [x] Based on upstream main and checked for merge conflicts. - [x] One topic. - [x] No game data, keys or decryption in the change, tests or report. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#1785
No description provided.