PE loader: refuse IAT and TLS-index writes inside the headers (#836) #854
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!854
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-854"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Longno242 on GitHub · 2026-11-24 06:51 UTC · original
Longno242:pe-loader-header-write-targets→main· +179 −2 · 1 files · 1 commits · openFixes #836.
A crafted PE whose import address table, delay-load HMODULE slot, or TLS
AddressOfIndexlands belowSizeOfHeaderswould let the manual mapper overwrite its own headers before later steps re-read them. Reject those directory-derived write targets once inpe.rs(PeError::HeaderWriteTarget). Targets must lie in[size_of_headers, size_of_image).What is in it
crates/xcl/src/pe.rs:ensure_data_write_rva, checks in import thunks / delay-load HMODULE / TLS index parsing, and unit tests for IAT, delay-load HMODULE, and TLS index inside the headers plus theSizeOfHeadersboundaryTested
rustc 1.97.1MSVC debug6ce1240498cd787448963da24cd8f5e892feb0da(clean tree, rebased ontoorigin/main47efa2e)46376c5:cargo test --workspace -- --test-threads=4: 716 passed, 0 failed, 41 ignoredcargo test -p xcl --lib pe::tests -- --test-threads=4: 14 passed, 0 failed (includes new delay-load HMODULE case)SKIPPEDGPU tests (prior full run):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64Regression run
scripts/smoke.ps1from @Toons29 (RX 9070, 60 s, same title/time; blocks as printed):Not tested
pe::testsre-run on this head)AI use
@dcastell1 on GitHub · 2026-11-24 07:50 UTC · original
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on clean
main@beaa245(713 passed, 0 failed, 41 ignored on this box):Three more passing tests than main, so the PE-loader refusals for IAT and TLS-index writes inside the headers are exercised here; nothing else changes verdict.
Tree restored afterwards (md5 and a full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@SlopTart on GitHub · 2026-11-24 08:09 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
46376c5onto main1ec4c98, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 707 passed, 11 failed, 41 ignored. Failures = the known Wine-lane set from my #42 rows plus #718 trio members and a hit ofgpu_mirror_upload_follows_cpu_writes_and_later_mapping_changes(new flake, see #718 addendum). PE-header write-rejection tests green - closes the #836 hardening on this rig.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@Longno242 on GitHub · 2026-11-24 12:51 UTC · original
Thanks for the independent verification runs (@dcastell1, @SlopTart).
This PR still needs the two retail
xcl-smokeblocks under Regression run (main + this head, same title/time) before the description check can pass. I do not have an Xbox Series X|S package here — only a PC Xbox Minecraft Launcher install, which is not a Scarlett title.If someone with a Series title can run:
and paste both
xcl-smoke v1blocks (or drop them here so I can add them to the description), that would unblock merge review. Happy to update the PR body and mark ready once those are in.No game data needed in the comment — only the smoke block text.
@Toons29 on GitHub · 2026-11-25 03:03 UTC · original
Regression run of
6ce12404on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainon4178e888, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 99 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; I checked the blocks before posting.@DavidM1911 on GitHub · 2026-11-25 10:15 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Longno242 on GitHub · 2026-11-25 12:36 UTC · original
Thanks @Toons29 — pasted both of your
xcl-smoke v1blocks under Regression run so the description check can see them.@Longno242 on GitHub · 2026-11-25 12:43 UTC · original
CI is stuck on
action_required(first-time contributor workflow approval). Smoke + PR description are green; please approve the pending CI workflow when you get a chance.@upipibi on GitHub · 2026-11-25 19:51 UTC · original
NVIDIA test report for
6ce1240(head as is, base47efa2e), for #1607's "one more test report" list. RTX 3070 8 GB (Ampere, 32-lane waves), driver 616.56, Windows 11, debug, aftercargo build --workspace:cargo test --workspace --no-fail-fast -- --test-threads=4 --skip hle::xaudio2: 736 passed, 0 failed, 41 ignored. The end-to-end title tests pass.hle::xaudio2, because its tests fail or hang on this machine onmaintoo. The PR doesn't touch it.no wave64on this card.AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.