fix(libkernel): stabilize virtual-query layout across hosts #5611
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5611"
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 boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T01:07:18Z.
What
On MinGW, VirtualQueryInfo's 32-bit flag allocation unit puts
nameat byte 36 andgpu_mask_idat byte 68; SysV puts them at 33 and 65. Both structures are 72 bytes, so a size check misses the discrepancy. Use byte-sized flag units and assert size, alignment and trailing field offsets. A named-mapping regression checks fixed byte offsets, canaries and cleared padding.This preserves the existing SysV contract. Astro's bundled AGC supports the 72-byte size and address/protection fields; console name and GPU-mask offsets remain unmeasured and are recorded in the library debt file.
Refreshed as one linear topic commit
ad78fbcdf78d5a93f0ca3f9d79eff68adad4b38bon main705b32d91986c02b2ba39ffcef3fff548a6dba68. The only merge conflict was additive debt text. Current main's complete debt file is retained, with this topic's entry appended. Source and test changes apply cleanly. No merge commits remain.Tested
Current refresh, Linux x86-64, GCC, Ryzen 9 7950X:
libs,guest_memory_testsandpatched_libraries_teststargets build successfully.guest_memoryandpatched_libraries: 2/2 pass, no skips, 0.67 seconds. This runs the raw-byte layout and canary regression with the current memory implementation.The local runtime build uses a private SPIRV-Tools teardown repair
b326807c0c9d8682b697fdad3153f77fc2642f5f; its only tree difference from the published topic is that gitlink, which is not part of this PR. The official dependency revision was not independently validated by this local build. Full Linux/Windows suite results for this refreshed head are pending maintainer CI.Historical full CI, earlier topic/base only: topic
cd28fc97e08b16e42d50f04a6d7ac4fcf3950dc1against base45d99dac82a9ad1ab8a7b1ff4ab8141e33cf920dpassed Linux hosted validation (1105 passed /52 skipped) and Windows validation (757 passed /423 skipped). Skipped cases remain unvalidated. An earlier unchanged Windows guest_memory job needed a rerun after a resident-mapping assertion; the cause was not established. Those historical runs do not establish full-suite success for the new head.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-14T02:10:06Z.
Review: COMMENTED
The fix is right.
uint32_tbitfields under MinGW'sms_structlayout take a 4-byte allocation unit, which movesnameto 36 andgpu_mask_idto 68. Byte-sized units give the SysV offsets on both hosts. Theoffsetofasserts are the right guard, since the size alone hid this.One convention point: the PR adds a code comment above the bitfields ("A byte-sized allocation unit also preserves the guest layout under MS bitfields."). CONVENTIONS.md only allows comments that mark technical debt, written by a human. The explanation is already in the debt entry, and the
static_asserts document the constraint in code, so the comment can go.Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-14T03:16:31Z.
Removed the redundant code comment in
2fd9f88023; the debt explanation and offsetof assertions remain. This head includes upstream maina5f493f90d. Current conventions pass. Fresh full Linux/Windows CI is pending; this is a comment-only correction to the layout change.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T13:21:30Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libkernel.mdL199Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mddocs/dev/debt/libkernel.mdcore/libs/SceTypes.hppcore/libs/tests/GuestMemory.cppdocs/dev/debt/libkernel.mdImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:33:32Z.
Checked on the merged tree: build and ctest for
core/libspass (32/32) andguest_memorypasses. The byte-sized flag units keep the SysV offsets (name at 33, gpu_mask_id at 65), thestatic_asserts pin size, alignment and offsets so MinGW would fail to compile with the old layout, andCheckVirtualQueryWireLayoutpins the raw bytes. The Windows run on the fork covers the MinGW side. Merging.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T12:19:49Z.
Checked on the merged tree: build and ctest for
core/libspass (32/32) andguest_memorypasses. The byte-sized flag units keep the SysV offsets (name at 33, gpu_mask_id at 65), thestatic_asserts pin size, alignment and offsets so MinGW would fail to compile with the old layout, andCheckVirtualQueryWireLayoutpins the raw bytes. The Windows run on the fork covers the MinGW side. The only conflict with main was the adjacent debt line indocs/dev/debt/libkernel.md; it is resolved by keeping both. Merging.