Tests: aim the failed page map at an address above user mode #3781
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3781"
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 BBareth on 2026-12-03T09:29:17Z.
an_address_keeps_the_page_the_title_mapped_there_lastgets "an address with nothing reserved" by reserving 64 KiB and releasing it. A test running beside it can be given that address in between. The map then succeeds: it commits into that test's memory and copies a 64 KiB page over it. The kernelx test fails, and the other test can read memory that is gone, so the lib test process exits with0xc0000005.The map now aims at the first 64 KiB above
lpMaximumApplicationAddress, where nothing can be reserved or committed.Rebased onto
maina815de93.mainfixed the other test this PR first changed,a_page_whose_move_fails_stays_mapped_where_it_was, ine4c076ca(#3743) the same way, so this PR now changes only the map test and uses that commit's form.What is in it
crates/xcl/src/hle/kernelx.rs(tests only): the failed map inan_address_keeps_the_page_the_title_mapped_there_lasttargets an address above user mode instead of a released reservation.Tested
cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on32f877bb(on maina815de93): 3018 passed, 0 failed, 56 ignored, 28SKIPPED(22 no wave64, 2 no heap windows, 2 no d3d12SDKLayers.dll, 1 no D3D12 debug layer, 1 driver cache).cargo test -p xcl --lib kernelx -- --test-threads=4, 20 runs on32f877bb: 19 passed.an_address_keeps_the_page_the_title_mapped_there_lastfailed in none. One run failed ina_page_leaving_plain_memory_has_the_tiles_over_it_linked_again, one of the tests that share kernelx's global page records without a common lock (not touched here).16c2fd08, 30 runs each), the map test failed in 10 of 30 runs on main and 2 of 30 with this change's first form; with #3759's GPU test beside it, the lib tests crashed with0xc0000005in 3 of 61 runs, and in none of 40 with the fix.Regression run
A test-only change; the runs are here for the check.
Each run follows one warm-up run of the same build; the A button is pressed once at 70 s.
Not tested
0xc0000005exit seen in some CI runs of the lib tests: those logs end at the crash without naming the test.AI use
🤖 Generated with Claude Code
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T09:30:39Z.
Review of
76fc17d7(code reading only, not a merge-check) · no findingsIn short: Test-only. Two
kernelxtests got "an address with nothing reserved" by reserving one and releasing it, which races tests running beside them: the address can be handed out in between, and the map or move then commits and writes into another test's memory. Both now use0x8000_0000_0000, above the user-mode range, where nothing can be reserved or committed. The fix is right, and nothing blocks it.Checked and fine
0x8000_0000_0000is past the highest user-mode address on x64 Windows (0x7FFF_FFFE_FFFF), so no allocation can ever be placed there, and Wine's 47-bit user space ends at the same point.MapTitlePhysicalPagesand the page move tryVirtualAlloc(at, MEM_COMMIT)first, and return null or fail when it fails, before anycopy_nonoverlappingorwrite_bytestoat(kernelx.rs~2585-2610). An unusable address is therefore never dereferenced;in_uma(at)is false there.mappedfilter with #3759's head, and says which otherkernelxtest failures remain and why.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by BBareth on 2026-12-03T16:03:57Z.
Rebased onto main
a815de93as32f877bb. Main fixed the page-move test ine4c076ca(#3743), so this PR now changes only the failed map inan_address_keeps_the_page_the_title_mapped_there_last, using that commit's form (the first 64 KiB abovelpMaximumApplicationAddress) instead of a constant.Suite on
32f877bb: 3018 passed, 0 failed, 56 ignored, 28 SKIPPED. The kernelx filter ran 20 times with no failure of the map test. The smoke block in the description was rerun on this head.AI use: Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T16:05:58Z.
Follow-up review of
32f877bb, since76fc17d7(code reading only, not a merge-check) · no new findingsIn short: Rebased onto
maina815de93.mainalready fixed the move test the same way ine4c076ca(#3743), so this PR now changes onlyan_address_keeps_the_page_the_title_mapped_there_last. It aims the failed map at the first 64 KiB abovelpMaximumApplicationAddress, the formmainuses, instead of a fixed0x8000_0000_0000. Still right; nothing blocks it.Checked and fine
(lpMaximumApplicationAddress + 1)rounded up to 64 KiB is0x7FFF_FFFF_0000on x64 Windows: the reserved no-access region past the last user address.VirtualAllocwithMEM_COMMITfails there, so the map returns null before anything is copied, and no other test can be given that address. Reading the limit fromGetSystemInfoalso covers a different user-space size under Wine.e4c076caput onmainfora_page_whose_move_fails_stays_mapped_where_it_was, so the two tests now agree. TheNO_USER_ADDRESSconstant from the earlier head is gone with that test.32f877bb(3018 passed, 0 failed, 56 ignored, 28 SKIPPED), and 20 runs of thekernelxfilter with no failure in this test. It names the one unrelated flakykernelxtest, which shares the global page records.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
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.