test(agc): skip the no-driver device test where an elevated loader still opens a device #14069

Merged
medazizktata merged 1 commit from upstream-pr/14069 into main 2026-11-05 23:14:56 +00:00
medazizktata commented 2026-10-31 17:47:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by medazizktata on 2026-10-31T17:47:00Z.


What

agc_driver_vulkan_test_device_no_driver hides the Vulkan driver by pointing VK_DRIVER_FILES and VK_ICD_FILENAMES at a manifest that does not exist. It then expects OpenVulkanTestDevice to report no device. On Windows the Vulkan loader ignores both variables in a process at high integrity or above (is_high_integrity in the loader's loader_environment.c). With VK_LOADER_DEBUG=all it says so: Loader is running with elevated permissions. Environment variable VK_DRIVER_FILES will be ignored.

So when the test runs elevated on a machine with a GPU, it opens the GPU and fails:

without a Vulkan driver the optional device was not skipped: NVIDIA GeForce RTX 4060

An OpenSSH session of an administrator account is elevated, for example.

The test now skips when the process is elevated and a device opened anyway, and the skip message names the device. When no device opens, it runs every check as before. The elevation check is the loader's own: the token's integrity level is at least SECURITY_MANDATORY_HIGH_RID.

CI does not show the failure:

  • The Linux job runs this test unelevated, on lavapipe.
  • The Windows jobs build ExecutionTestNotBuilt.cpp in its place (-DANYPS5_AGC_EXECUTION_TESTS), so CI does not compile the new _WIN32 code.

Test only; no runtime change.

Tested

Windows 11 Pro 10.0.26200, i5-12600KF, NVIDIA GeForce RTX 4060, driver 610.88, Vulkan loader 1.4.363, WinLibs GCC 15.2.0 r7, Release, main cd087bd12c. "Medium" is the same ctest started with a copy of the token lowered to medium integrity.

agc_driver_vulkan_test_device* elevated medium
main _no_driver fails 3/3 (above) both pass
this change _no_driver skipped: skipped, the Vulkan loader ignores VK_DRIVER_FILES in an elevated process and opened NVIDIA GeForce RTX 4060 both pass 3/3; _no_driver runs every check
this change, elevation check forced false _no_driver fails 3/3
restored _no_driver skipped; agc_driver_vulkan_test_device passes 5/5 both pass 5/5
ctest -R ^agc -j4, elevated, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1 1186/1186
ctest -E agc, elevated 2002/2002

Pop!_OS 24.04, GCC 13.3.0, Release, llvmpipe: both tests pass 3/3, and _no_driver runs every check. The test binary does not change, because the new code is Windows-only. ctest -E agc passes 1917/1917.

Not tested: an elevated run on an AMD or Intel GPU.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4060 (driver 610.88, Windows 11); llvmpipe (Linux)
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5100036004 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14069). Originally posted by [medazizktata](https://github.com/medazizktata) on 2026-10-31T17:47:00Z. --- ### What `agc_driver_vulkan_test_device_no_driver` hides the Vulkan driver by pointing `VK_DRIVER_FILES` and `VK_ICD_FILENAMES` at a manifest that does not exist. It then expects `OpenVulkanTestDevice` to report no device. On Windows the Vulkan loader ignores both variables in a process at high integrity or above (`is_high_integrity` in the loader's `loader_environment.c`). With `VK_LOADER_DEBUG=all` it says so: `Loader is running with elevated permissions. Environment variable VK_DRIVER_FILES will be ignored`. So when the test runs elevated on a machine with a GPU, it opens the GPU and fails: ``` without a Vulkan driver the optional device was not skipped: NVIDIA GeForce RTX 4060 ``` An OpenSSH session of an administrator account is elevated, for example. The test now skips when the process is elevated **and** a device opened anyway, and the skip message names the device. When no device opens, it runs every check as before. The elevation check is the loader's own: the token's integrity level is at least `SECURITY_MANDATORY_HIGH_RID`. CI does not show the failure: - The Linux job runs this test unelevated, on lavapipe. - The Windows jobs build `ExecutionTestNotBuilt.cpp` in its place (`-DANYPS5_AGC_EXECUTION_TESTS`), so CI does not compile the new `_WIN32` code. Test only; no runtime change. ### Tested Windows 11 Pro 10.0.26200, i5-12600KF, NVIDIA GeForce RTX 4060, driver 610.88, Vulkan loader 1.4.363, WinLibs GCC 15.2.0 r7, Release, `main` `cd087bd12c`. "Medium" is the same ctest started with a copy of the token lowered to medium integrity. | `agc_driver_vulkan_test_device*` | elevated | medium | |---|---|---| | `main` | `_no_driver` **fails 3/3** (above) | both pass | | this change | `_no_driver` skipped: `skipped, the Vulkan loader ignores VK_DRIVER_FILES in an elevated process and opened NVIDIA GeForce RTX 4060` | both pass 3/3; `_no_driver` runs every check | | this change, elevation check forced false | `_no_driver` **fails 3/3** | | | restored | `_no_driver` skipped; `agc_driver_vulkan_test_device` passes 5/5 | both pass 5/5 | | `ctest -R ^agc -j4`, elevated, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1` | 1186/1186 | | | `ctest -E agc`, elevated | 2002/2002 | | Pop!_OS 24.04, GCC 13.3.0, Release, llvmpipe: both tests pass 3/3, and `_no_driver` runs every check. The test binary does not change, because the new code is Windows-only. `ctest -E agc` passes 1917/1917. Not tested: an elevated run on an AMD or Intel GPU. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4060 (driver 610.88, Windows 11); llvmpipe (Linux) - [x] AI-assisted: yes (Claude Code)
MarcZX10 commented 2026-10-31 17:59:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-31T17:59:52Z.

Review: APPROVED


Reviewed — looks good

The new skip is limited to an elevated Windows run that actually opens a device despite the configured no-driver environment, while the no-device assertions remain in place.

What I ran

Reviewed head 3913101faca7cde2b88cab5f01377efd060fbfba against base 0f302813cebfc09e3e0b6f8fced15262d186879e; the merge preview is clean. Environment: Debian Linux 6.1, Python 3.11.2. I did not compile the Windows-only test code.

python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14069 --output-dir /tmp/anyps5-14069-review
git show 3913101faca7cde2b88cab5f01377efd060fbfba:core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.cpp
python3 tools/check_conventions.py --base 0f302813cebfc09e3e0b6f8fced15262d186879e --head 3913101faca7cde2b88cab5f01377efd060fbfba --title "test(agc): skip the no-driver device test where an elevated loader still opens a device" --body /tmp/anyps5-14069-review/pr-body.md
git show 3913101faca7cde2b88cab5f01377efd060fbfba:core/libs/prx/libSceAgcDriver/CMakeLists.txt | sed -n '2585,2592p'

Results

Check Result
Patch and conventions Passed.
Dependency and merge preview Passed; clean against current main, with no declared dependencies.
Skip behavior and registration Source review confirms the return uses the existing VulkanTestSkipped value (77), and CTest already maps 77 to skipped for this test. The path only skips when the initial open returned a device and the Windows token is high-integrity or above.
Author-reported Windows tests The author reports the baseline elevated no-driver case failing 3/3, the changed case skipping with the opened device named, medium-integrity cases passing 3/3, and forcing the elevation check false restoring the failure. The author also reports elevated CTest groups passing 1186/1186 and 2002/2002. I did not independently run these.
Author-reported Linux tests The author reports the two device tests passing 3/3 on Pop!_OS with llvmpipe, with the no-driver checks still executing.
Hosted checks Eligibility, conventions, library portability, intake, labels, report, and Windows passed. The Windows job used ExecutionTestNotBuilt.cpp in place of this test source; Linux and other build/test jobs were skipped.
Build or tests run here None; this initial review did not build.
Raw outputs and relevant source excerpts

Conventions output:

All conventions checks passed.

Dependency report:

- PR #14069: **clean** against current base; head `3913101faca7cde2b88cab5f01377efd060fbfba`
No declared PR dependencies were found in the target PR chain.

CTest registration:

add_test(NAME agc_driver_vulkan_test_device_no_driver COMMAND agc_driver_vulkan_test_device_tests --no-driver)
set_tests_properties(agc_driver_vulkan_test_device_no_driver PROPERTIES
        ENVIRONMENT "VK_DRIVER_FILES=${CMAKE_CURRENT_BINARY_DIR}/no-vulkan-driver.json;VK_ICD_FILENAMES=${CMAKE_CURRENT_BINARY_DIR}/no-vulkan-driver.json"
        TIMEOUT 30 SKIP_RETURN_CODE 77 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")

Vulkan loader source at 1.4.365 reports elevated integrity at or above SECURITY_MANDATORY_HIGH_RID; the added helper uses the same threshold. The loader's secure environment lookup returns no value at that integrity level.

Negative control

Assertion Mutation reported by author Did the new test fail?
An elevated no-driver run must not pass as though no device were available when the loader opens a real device. Forced HighIntegrity() to return false on the author’s Windows 11/RTX 4060 setup. Yes, author reports the no-driver test failed 3/3 with the unexpected-device assertion. Not independently reproduced here.

Findings

Blocking

None found.

Non-blocking

None.

Sources

Not verified

I did not compile or run the Windows-only test code. The author’s reported Windows and Linux runs were not independently reproduced; the hosted Windows build replaces this test source with a stub.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5724175510 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14069#pullrequestreview-5724175510). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-31T17:59:52Z. **Review:** APPROVED --- # Reviewed — looks good The new skip is limited to an elevated Windows run that actually opens a device despite the configured no-driver environment, while the no-device assertions remain in place. ## What I ran Reviewed head `3913101faca7cde2b88cab5f01377efd060fbfba` against base `0f302813cebfc09e3e0b6f8fced15262d186879e`; the merge preview is clean. Environment: Debian Linux 6.1, Python 3.11.2. I did not compile the Windows-only test code. ```sh python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 14069 --output-dir /tmp/anyps5-14069-review git show 3913101faca7cde2b88cab5f01377efd060fbfba:core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.cpp python3 tools/check_conventions.py --base 0f302813cebfc09e3e0b6f8fced15262d186879e --head 3913101faca7cde2b88cab5f01377efd060fbfba --title "test(agc): skip the no-driver device test where an elevated loader still opens a device" --body /tmp/anyps5-14069-review/pr-body.md git show 3913101faca7cde2b88cab5f01377efd060fbfba:core/libs/prx/libSceAgcDriver/CMakeLists.txt | sed -n '2585,2592p' ``` ## Results | Check | Result | |---|---| | Patch and conventions | Passed. | | Dependency and merge preview | Passed; clean against current `main`, with no declared dependencies. | | Skip behavior and registration | Source review confirms the return uses the existing `VulkanTestSkipped` value (77), and CTest already maps 77 to skipped for this test. The path only skips when the initial open returned a device and the Windows token is high-integrity or above. | | Author-reported Windows tests | The author reports the baseline elevated no-driver case failing 3/3, the changed case skipping with the opened device named, medium-integrity cases passing 3/3, and forcing the elevation check false restoring the failure. The author also reports elevated CTest groups passing 1186/1186 and 2002/2002. I did not independently run these. | | Author-reported Linux tests | The author reports the two device tests passing 3/3 on Pop!_OS with llvmpipe, with the no-driver checks still executing. | | Hosted checks | Eligibility, conventions, library portability, intake, labels, report, and Windows passed. The Windows job used `ExecutionTestNotBuilt.cpp` in place of this test source; Linux and other build/test jobs were skipped. | | Build or tests run here | None; this initial review did not build. | <details><summary>Raw outputs and relevant source excerpts</summary> Conventions output: ```text All conventions checks passed. ``` Dependency report: ```text - PR #14069: **clean** against current base; head `3913101faca7cde2b88cab5f01377efd060fbfba` No declared PR dependencies were found in the target PR chain. ``` CTest registration: ```cmake add_test(NAME agc_driver_vulkan_test_device_no_driver COMMAND agc_driver_vulkan_test_device_tests --no-driver) set_tests_properties(agc_driver_vulkan_test_device_no_driver PROPERTIES ENVIRONMENT "VK_DRIVER_FILES=${CMAKE_CURRENT_BINARY_DIR}/no-vulkan-driver.json;VK_ICD_FILENAMES=${CMAKE_CURRENT_BINARY_DIR}/no-vulkan-driver.json" TIMEOUT 30 SKIP_RETURN_CODE 77 WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}") ``` Vulkan loader source at 1.4.365 reports elevated integrity at or above `SECURITY_MANDATORY_HIGH_RID`; the added helper uses the same threshold. The loader's secure environment lookup returns no value at that integrity level. </details> ## Negative control | Assertion | Mutation reported by author | Did the new test fail? | |---|---|---| | An elevated no-driver run must not pass as though no device were available when the loader opens a real device. | Forced `HighIntegrity()` to return false on the author’s Windows 11/RTX 4060 setup. | Yes, author reports the no-driver test failed 3/3 with the unexpected-device assertion. Not independently reproduced here. | ## Findings ### Blocking None found. ### Non-blocking None. ## Sources - [Elevation check and constrained skip at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/3913101faca7cde2b88cab5f01377efd060fbfba/core/libs/prx/libSceAgcDriver/tests/execution/VulkanTestDevice.cpp#L30-L90) - [CTest skip return-code registration at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/3913101faca7cde2b88cab5f01377efd060fbfba/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L2585-L2592) - [Vulkan-Loader 1.4.365 elevated-integrity check](https://github.com/KhronosGroup/Vulkan-Loader/blob/f866657ff687a36d767cd7783bab800e31ebafaa/loader/loader_environment.c#L90-L110) ## Not verified I did not compile or run the Windows-only test code. The author’s reported Windows and Linux runs were not independently reproduced; the hosted Windows build replaces this test source with a stub.
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
boykopovar/AnyPS5!14069
No description provided.