loader: fault clzero on guarded or reserved pages instead of declining #232

Closed
github-bot wants to merge 531 commits from github-bot/gh-232 into main AGit
Owner

@⁠mint17 on GitHub · 2026-11-27 11:22 UTC · original
mint17:fix/loader-clzero-guarded-pages → main · +43933 −3934 · 183 files · 531 commits · closed without merging

Port fxceless/victory-fork@b3b65aa25b (#1380) to Vice-Tay's clzero and 12-byte ClzeroLoop emulation while preserving #170:

  • Reject PAGE_GUARD regions in writable_to so guarded pages are not cached as unconditionally writable.
  • Add zero_through_fault to issue volatile u64 zero stores on MEM_COMMIT (guarded/read-only/no-access) and MEM_RESERVE lines so the runtime's write-watch / demand-commit VEH handler opens them, while still declining MEM_FREE / unmapped lines.
  • Defer patch_clzero until after confirming the target is mapped, check the 16-byte patch boundary before locking STUBS, and match the exact unpatched clzero loop prefix to prevent concurrent double-patching.
  • Add a self-contained Windows VEH unit test covering PAGE_READONLY, MEM_RESERVE, PAGE_NOACCESS, PAGE_GUARD, ClzeroLoop EFlags, and MEM_FREE.
**@⁠mint17** on GitHub · 2026-11-27 11:22 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/232) `mint17:fix/loader-clzero-guarded-pages` → `main` · +43933 −3934 · 183 files · 531 commits · closed without merging Port fxceless/victory-fork@b3b65aa25b (#1380) to Vice-Tay's clzero and 12-byte ClzeroLoop emulation while preserving #170: - Reject PAGE_GUARD regions in writable_to so guarded pages are not cached as unconditionally writable. - Add zero_through_fault to issue volatile u64 zero stores on MEM_COMMIT (guarded/read-only/no-access) and MEM_RESERVE lines so the runtime's write-watch / demand-commit VEH handler opens them, while still declining MEM_FREE / unmapped lines. - Defer patch_clzero until after confirming the target is mapped, check the 16-byte patch boundary before locking STUBS, and match the exact unpatched clzero loop prefix to prevent concurrent double-patching. - Add a self-contained Windows VEH unit test covering PAGE_READONLY, MEM_RESERVE, PAGE_NOACCESS, PAGE_GUARD, ClzeroLoop EFlags, and MEM_FREE.
Port fxceless/victory-fork@b3b65aa25b (#1380) to Vice-Tay's clzero and
12-byte ClzeroLoop emulation while preserving #170:

- Reject PAGE_GUARD regions in writable_to so guarded pages are not cached
  as unconditionally writable.
- Add zero_through_fault to issue volatile u64 zero stores on MEM_COMMIT
  (guarded/read-only/no-access) and MEM_RESERVE lines so the runtime's
  write-watch / demand-commit VEH handler opens them, while still declining
  MEM_FREE / unmapped lines.
- Defer patch_clzero until after confirming the target is mapped, check
  the 16-byte patch boundary before locking STUBS, and match the exact
  unpatched clzero loop prefix to prevent concurrent double-patching.
- Add a self-contained Windows VEH unit test covering PAGE_READONLY,
  MEM_RESERVE, PAGE_NOACCESS, PAGE_GUARD, ClzeroLoop EFlags, and MEM_FREE.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 11:25:53 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-27 11:42 UTC · original

@⁠mint17 The unmapped case is an important control here. A declined emulation needs to preserve the original instruction state and memory. Before integrating, I’ll check that the guarded-page path stays within a full cache line in the title’s managed mappings and that the boundary case still declines cleanly.

**@⁠TaynanGT** on GitHub · 2026-11-27 11:42 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/232#issuecomment-7217378633) @⁠mint17 The unmapped case is an important control here. A declined emulation needs to preserve the original instruction state and memory. Before integrating, I’ll check that the guarded-page path stays within a full cache line in the title’s managed mappings and that the boundary case still declines cleanly.
github-bot closed this pull request 2026-11-30 17:20:59 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-30 17:15 UTC · original

main has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current main and open a new PR; I'll review it there.

**@⁠TaynanGT** on GitHub · 2026-11-30 17:15 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/232#issuecomment-7285973834) `main` has moved to a new line of the code and everything is now named Vice-Tay, so this PR no longer applies as it is (details in #468). If you'd like this change in, please rebuild it on the current `main` and open a new PR; I'll review it there.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.