Repository navigation
runtime: preserve LoadLibraryEx reserved-handle validation - #9689
tecnofifamobile-ai wants to merge 1 commit into
Conversation
|
Post-push verification of Local results: native Windows returned |
|
Tested checked: #968906e507c | with: cmake --build runtime/build --config RelWithDebInfo --target gta6rt tiny_bundled_load loader_test pe_loader_test module_names_test && ctest --test-dir runtime/build -C RelWithDebInfo --output-on-failure -R "loader|module_names|bundled" | on: Windows 11, MSVC 19.52, NVIDIA GeForce RTX 5060 Ti (610.88) | result: 7/7 passed (loader, module_names, run_module_names, pe_loader, pe_loader_bounds, loader_tls, run_tiny_bundled_load), diff reviewed, synthetic inputs only, no game files. AI-assisted. |
|
Tested
AI-assisted run (Claude via OpenCode). |
|
Tested
AI-assisted: yes |
Claimed in the coordination issue as: LOADLIBRARYEX-RESERVED-HFILE
What and why
Windows reserves the
hFileparameter ofLoadLibraryExA/W. The coordination finding identified that the shim-owned and bundled lookup paths ignored it. A call with a non-null handle could return a pseudo-handle or map a bundled DLL before reaching the host.On native Windows, both calls returned
NULLwithERROR_INVALID_PARAMETER(87) when passed a real file handle. With the new fixture on base5d74c272, the ANSI call reached the shim-owned module and the Unicode call mapped the bundled DLL. The test exited 1.The patch limits name-based resolution to calls with null
hFile. Calls with a non-null handle go directly to the corresponding Win32 API with all arguments preserved. The fixture covers both encodings and both lookup paths, verifies the rejected DLL stays unmapped, then exercises the existing null-handle load and its attach/export checks. Regression risk is confined to the handling of the reserved non-null argument.Tested
Windows 11 build 26200, MSVC 19.51.36257.0, Windows SDK 10.0.28000.0, CMake 4.3.1-msvc1, x64
RelWithDebInfo. CPU-only for the regression. The relatedrun_tiny_framesmoke test ran on Radeon RX 9070 XT, AMD 26.11.2, Windows driver 32.0.32029.2010.From the repository root with a configured Windows build:
tiny_bundled_loadfixture only and runctest -R '^run_tiny_bundled_load$'with the baseline loader. The guest exits 1 after the invalid call reaches the shim. With the patched loader, all 11 selected CTests pass.NULL / 87with the source-built DLL opened for reading.git diff --check,scripts/check_no_game_data.pyand the repeated-lines and PR-template tests passed. The docs-link suite reported the same two unrelated relative-link failures in a clean baseline and in this branch.Provenance: public Win32 A reference and W reference, plus a synthetic native/mapped comparison. Scope is the Win32 contract for a reserved argument. No retail files or console execution were used.
AI-assisted: yes (Codex).
Checklist
docs/design.md, with how it was confirmed. (N/A, loader change.)