pe: initialize the default x64 security cookie before startup #892

Merged
R0Y00 merged 1 commit from upstream-pr/899 into main 2026-11-23 16:41:17 +00:00
R0Y00 commented 2026-11-23 16:28:02 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-23T16:28:02Z.


Refs #870.

On a CRT-free DLL and EXE, Windows 11 initializes the default x64 security cookie before guest entry. The original mapper left the file value in place. Initialize the eligible slot with the Windows system random generator after relocation and before callbacks or entry, and reject a destination outside an aligned writable image section.

The fixture checks both loaders on the default cookie, short load-config prefixes, an unused-cookie flag and a preinitialized value. It also checks the mapper's refusal of a read-only destination. Running the new fixture against the original mapper fails on the default cookie.

Windows x64, MSVC 19.51, Release:

ctest --preset release --no-tests=error -R '^(cpu_native_(load_cookie|mutation|reloc_free|seh|section|tls|tls_value))$' --output-on-failure

7/7 passed with normal Windows process permissions. Documentation links, bidi controls and git diff --check passed.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6563849698 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/899). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-23T16:28:02Z. --- Refs #870. On a CRT-free DLL and EXE, Windows 11 initializes the default x64 security cookie before guest entry. The original mapper left the file value in place. Initialize the eligible slot with the Windows system random generator after relocation and before callbacks or entry, and reject a destination outside an aligned writable image section. The fixture checks both loaders on the default cookie, short load-config prefixes, an unused-cookie flag and a preinitialized value. It also checks the mapper's refusal of a read-only destination. Running the new fixture against the original mapper fails on the default cookie. Windows x64, MSVC 19.51, Release: ```powershell ctest --preset release --no-tests=error -R '^(cpu_native_(load_cookie|mutation|reloc_free|seh|section|tls|tls_value))$' --output-on-failure ``` 7/7 passed with normal Windows process permissions. Documentation links, bidi controls and `git diff --check` passed.
upstream-sync closed this pull request 2026-11-24 06:45:19 +00:00
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
R0Y00/Xbox2Windows!892
No description provided.