PE loader: find a title's masked stores by walking its functions #1303
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1313"
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?
Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-24T14:37:23Z.
Stacked on #1311 (which is stacked on #1303); only the top commit (
0f1fdf6) belongs here. Third of four PRs bringing @Ahmet-Dedeler's masked-store fix for Rosetta 2 frommac-on-main-wip(b51552b) tomain. Part of #258.planfinds the masked stores in a mapped image and writes their helpers (#1311). It does not trust a byte pattern: it walks the instructions from the start of the function that the unwind data names and takes the pattern only if the walk lands exactly on it, so bytes inside another instruction or in data are left alone. A store in a leaf function (no unwind data) is walked to from the end of the function before it. Nothing callsplanyet; PR 4 calls it from the loader under Rosetta 2.What is in it
maskmov.rs:plan,Plan,Site,Skip(why a pattern was left: no function, an instruction the walk does not know, not at an instruction boundary, a form the helper does not take) andGAP_MAX(how far behind a function a leaf function's store may be, 64 KiB).a_site_is_a_pattern_the_walk_from_its_function_arrives_at: a made-up image with a store in a function, two in a row sharing a helper, one in a leaf function, the pattern inside amov rax, imm64, behind an EVEX instruction, and far from any function; plus a section that ends inside a pattern and one with no function.b51552b'smaskmov.rs); only the module comment's last line says the loader step comes later. The commit keeps him as author.Tested
x86_64-pc-windows-gnuwith mingw-w64 (GCC 16.2.0), Rust 1.100.0, debug; the lib test binary run under CrossOver'swine.maskmov::on this head: 7 passed, 0 failed, 1 ignored (the reproduction described in #1311).Regression run
From @Toons29: AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, Windows 11 build 26300, release builds,
scripts/smoke.ps1, the same retail title for 60 s,main4178e88and this head: 101 % ofmain's frames, 100 % of its peak commit, no crash, no device removal.Nothing calls this code yet, so the pair shows only that the title runs as on
main.Not tested
mac-on-main-wipreport 1,130 stores found in a retail executable (none skipped) and the walk checked against Capstone on 22.4 million instructions; I have no title and did not repeat that.cargo test --workspaceas a whole (it does not finish under CrossOver, see #258).AI use
claude-opus-5-5): split the commit, ran the tests above and wrote this description. The code and test are Ahmet's.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T15:38:45Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, ~21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
Imported from ivall/xcl. Originally posted by Toons29 on 2026-11-25T03:23:16Z.
Regression run of
0f1fdf64on 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, 100 % 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.upstream-sync referenced this pull request2026-11-25 16:10:51 +00:00
Imported from ivall/xcl. Originally posted by upipibi on 2026-11-26T05:11:33Z.
NVIDIA test report for
0f1fdf6: RTX 3070 8 GB (Ampere, driver 616.56), Windows 11 26100, Rust 1.100.0, debug.cargo test -p xcl --lib -- --skip hle::xaudio2 --test-threads=4(thehle::xaudio2tests hang on this machine, onmaintoo):no wave64). The sevenmaskmovtests pass, including the newa_site_is_a_pattern_the_walk_from_its_function_arrives_at; the ignored one is the PR's ownthe_instruction_itself_across_a_watched_page_boundary.Lib tests only; no title run.
AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-29T15:50:37Z.
Thanks @upipibi for the NVIDIA run. Each part of the masked-store stack now has a run from someone other than me; it waits for a maintainer review and merges cleanly into
main.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:24:43Z.
Triage (#1607) – head
0f1fdf6This is the third PR of a stack: it is stacked on #1311 (on #1303), and #1344 sits on top of it. The shared lines are the stack, not a duplicate. No other open or merged PR finds masked-store sites.
I read the top commit (
maskmov::planand its test) and found no problems. Note that nothing callsplanuntil #1344.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.