test: use an invalid handle in the existing-heap check (TEST-D3D12-EXISTING-HEAP-INVALID-HANDLE) #2515

Merged
TheGeogeo merged 1 commit from upstream-pr/2515 into main 2026-11-28 15:12:11 +00:00
TheGeogeo commented 2026-11-27 23:46:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-27T23:46:06Z.


Claimed in the coordination issue as: TEST-D3D12-EXISTING-HEAP-INVALID-HANDLE

What and why

d3d12_existing_heap_test passes 0x1234 to OpenExistingHeapFromFileMapping and expects E_INVALIDARG. Windows can assign that value to a live handle, so the Vulkan shim returns E_NOTIMPL and the test fails.

Use -0x10000 as the invalid-handle sentinel and check it with GetHandleInformation before asserting the HRESULT.

Tested

  • On main (d44285197), a temporary control retained a synthetic event at 0x1234. The test returned E_NOTIMPL where it expected E_INVALIDARG. The same control passed with the fix.
  • Rebuilt the final test with MSVC 19.52.37029 in RelWithDebInfo. All five targeted CTest cases passed: d3d12_existing_heap, d3d12_host_prefix, d3d12_mapped_plane_async, and both existing-heap write-watch variants.
  • git diff --check and scripts/check_no_game_data.py on the changed file passed.

GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 build 26300.

AI-assisted: yes (Codex).

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys, decryption, or game-derived logs.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5534581629 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2515). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-27T23:46:06Z. --- Claimed in the coordination issue as: [TEST-D3D12-EXISTING-HEAP-INVALID-HANDLE](https://github.com/ProjectLeonida/mandy/issues/1608#issuecomment-7230377833) ### What and why `d3d12_existing_heap_test` passes `0x1234` to `OpenExistingHeapFromFileMapping` and expects `E_INVALIDARG`. Windows can assign that value to a live handle, so the Vulkan shim returns `E_NOTIMPL` and the test fails. Use `-0x10000` as the invalid-handle sentinel and check it with `GetHandleInformation` before asserting the HRESULT. ### Tested - On `main` (`d44285197`), a temporary control retained a synthetic event at `0x1234`. The test returned `E_NOTIMPL` where it expected `E_INVALIDARG`. The same control passed with the fix. - Rebuilt the final test with MSVC 19.52.37029 in `RelWithDebInfo`. All five targeted CTest cases passed: `d3d12_existing_heap`, `d3d12_host_prefix`, `d3d12_mapped_plane_async`, and both existing-heap write-watch variants. - `git diff --check` and `scripts/check_no_game_data.py` on the changed file passed. GPUs tested: NVIDIA GeForce RTX 3080, driver 621.40, Windows 11 build 26300. AI-assisted: yes (Codex). ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys, decryption, or game-derived logs.
OreoFR commented 2026-11-27 23:59:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-27T23:59:17Z.


Review of 6e5e82e40, asked for in the French Discord group. I read the diff and the shim, and built and ran the test. No game files were used.

Read in code. The fix matches what the shim checks. OpenExistingHeapFromFileMapping (runtime/shims/d3d12_vulkan_device.cpp:19820-19827 on main d44285197) returns E_INVALIDARG only when GetHandleInformation fails. With a valid handle it returns E_NOTIMPL. So a live handle at 0x1234 produces exactly the failure described here. The new EXPECT(!GetHandleInformation(...)) asserts that same precondition before the HRESULT check. -0x10000 is outside the small negative pseudo-handle range, and a user-mode process never gets a real handle with that value.

Tested. Windows 11, MSVC Build Tools 2022, RelWithDebInfo, RTX 4070 Laptop 8 GB with NVIDIA 621.40. I built d3d12_existing_heap_test on main d44285197 and again with this file. Both exit 0, and the run ends with "vulkan vs host WARP: 8 OpenExistingHeapFromAddress cases match". 0x1234 wasn't live in my main run, so I couldn't reproduce the collision. Your forced-collision control covers that case.

Looks good to me.

AI-assisted (Claude Code, Claude Opus 5.5), for OreoFR.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7230556452 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2515#issuecomment-7230556452). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-27T23:59:17Z. --- Review of 6e5e82e40, asked for in the French Discord group. I read the diff and the shim, and built and ran the test. No game files were used. **Read in code.** The fix matches what the shim checks. `OpenExistingHeapFromFileMapping` (`runtime/shims/d3d12_vulkan_device.cpp:19820-19827` on main d44285197) returns `E_INVALIDARG` only when `GetHandleInformation` fails. With a valid handle it returns `E_NOTIMPL`. So a live handle at `0x1234` produces exactly the failure described here. The new `EXPECT(!GetHandleInformation(...))` asserts that same precondition before the HRESULT check. `-0x10000` is outside the small negative pseudo-handle range, and a user-mode process never gets a real handle with that value. **Tested.** Windows 11, MSVC Build Tools 2022, RelWithDebInfo, RTX 4070 Laptop 8 GB with NVIDIA 621.40. I built `d3d12_existing_heap_test` on main d44285197 and again with this file. Both exit 0, and the run ends with "vulkan vs host WARP: 8 OpenExistingHeapFromAddress cases match". `0x1234` wasn't live in my main run, so I couldn't reproduce the collision. Your forced-collision control covers that case. Looks good to me. AI-assisted (Claude Code, Claude Opus 5.5), for OreoFR.
zmasi commented 2026-11-28 09:52:18 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T09:52:18Z.


#2515 | head 6e5e82e400 (merged cleanly with main 3ca0707dde) | ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_existing_heap" --output-on-failure | red on main: when HANDLE(0x1234) collides with a live kernel handle in the process (reproduced deterministically by opening kernel events until 0x1234 is live), OpenExistingHeapFromFileMapping(HANDLE(0x1234), ...) returns E_NOTIMPL instead of E_INVALIDARG and fails d3d12_existing_heap_test | green on PR+main: 3/3 CTests pass on RTX 3090 (d3d12_existing_heap in 9.15s, d3d12_existing_heap_no_write_watch in 6.96s, d3d12_existing_heap_write_watch in 9.08s, verifying !GetHandleInformation(HANDLE(-0x10000), ...) before checking E_INVALIDARG); check_no_game_data.py 0 violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7237521003 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2515#issuecomment-7237521003). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-28T09:52:18Z. --- #2515 | head 6e5e82e4003ae9971afc36fa79d051d23d3255cd (merged cleanly with main 3ca0707ddec7fd868ecd6df924d751901102fd9c) | `ctest --test-dir runtime/build -C RelWithDebInfo -R "^d3d12_existing_heap" --output-on-failure` | red on main: when `HANDLE(0x1234)` collides with a live kernel handle in the process (reproduced deterministically by opening kernel events until `0x1234` is live), `OpenExistingHeapFromFileMapping(HANDLE(0x1234), ...)` returns `E_NOTIMPL` instead of `E_INVALIDARG` and fails `d3d12_existing_heap_test` | green on PR+main: `3/3` CTests pass on RTX 3090 (`d3d12_existing_heap` in `9.15s`, `d3d12_existing_heap_no_write_watch` in `6.96s`, `d3d12_existing_heap_write_watch` in `9.08s`, verifying `!GetHandleInformation(HANDLE(-0x10000), ...)` before checking `E_INVALIDARG`); `check_no_game_data.py` `0` violations | Windows 11, RTX 3090 (610.88), Vulkan SDK 1.4.363.1 | AI-assisted: yes
MoonEyes commented 2026-11-28 15:12:09 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T15:12:09Z.


Red/green: with a live handle forced at 0x1234, main fails at line 91 with E_NOTIMPL instead of E_INVALIDARG, and the PR passes under the same control (d3d12_existing_heap_test built alone, 5 ctest cases pass).
Full local suite (python standalone, pytest, semantic, node) with the PR merged on main 1a441d336: no new failure; merge-tree clean on main 745aa4398.
AI-assisted (Claude Code, Claude Opus 5.5)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7241282441 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2515#issuecomment-7241282441). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T15:12:09Z. --- Red/green: with a live handle forced at 0x1234, main fails at line 91 with E_NOTIMPL instead of E_INVALIDARG, and the PR passes under the same control (d3d12_existing_heap_test built alone, 5 ctest cases pass). Full local suite (python standalone, pytest, semantic, node) with the PR merged on main 1a441d336: no new failure; merge-tree clean on main 745aa4398. AI-assisted (Claude Code, Claude Opus 5.5)
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2515
No description provided.