vicrec: one seam for the address-space calls, so the restore builds on Windows #2
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!2
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2"
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?
@borosf on GitHub · 2026-11-30 12:01 UTC · original
borosf:platform-windows-vicrec→main· +339 −61 · 5 files · 1 commits · closed without mergingThe restore maps title memory at the title's own addresses, and until now reached the system calls directly:
mmapPROT_NONE|MAP_NORESERVEto reserve,mmapPROT_RWfor memory the recorder held outside the listed regions,mprotectto commit a granule,/proc/self/mapsfor the mapping list, andstd::os::unix::fs::FileExtfor the capture reads. That is whyvicrecwas the first crate to stop a Windows build, with twenty errors, beforeumemorvkbackwere even reached.Windows has the same powers with different calls, and two steps where Linux has one.
mmap(PROT_NONE, MAP_NORESERVE, MAP_FIXED_NOREPLACE)VirtualAlloc(MEM_RESERVE, PAGE_NOACCESS)mmap(PROT_READ|PROT_WRITE, MAP_FIXED_NOREPLACE)VirtualAlloc(MEM_RESERVE|MEM_COMMIT, PAGE_READWRITE)mprotect(PROT_READ|PROT_WRITE)VirtualAlloc(MEM_COMMIT, PAGE_READWRITE)/proc/self/mapsVirtualQuerywalk, names fromGetMappedFileNameWread_exact_atseek_read, looped (it returns short reads)src/platform.rsis that seam, oneimpper system. The granule is 64 KiB (restore.rsGRANULE), which is exactly Windows' allocation granularity, so one granule of the restore is one Windows allocation and a commit can never straddle two — the two systems' granularities agree here by luck, not by design, and the file says so.Neither side may move: every caller writes at the title's address, so a call that cannot get that address fails instead of landing elsewhere —
MAP_FIXED_NOREPLACEon Linux, a non-null base on Windows, which fails when the range is in use (ERROR_INVALID_ADDRESSis reported as "in use").No behaviour change on Linux: the same flags, the same error text, the same order of bookkeeping and call.
Verified
Windows 11, rustc 1.100.0,
x86_64-pc-windows-msvc:restore_small_piecesis the one that matters: it maps real granules through this seam, so the Windows path is exercised by a test, not only compiled.What this is not
It is not the Windows port; it is step 0 of it — one crate's worth of seam, in the shape the rest can follow (
umemnext, 36 platform lines;vkback63). I opened #1 with the seam inventory and the two decisions I think are the maintainer's rather than mine (the 64-lane mesh requirement inpipejob, and whetherumem's dma-buf chunk model should be inverted on Windows so the section is the allocator). This PR does not prejudge either.AI-assisted: yes.
@vktory6 on GitHub · 2026-11-30 18:59 UTC · original
Thanks. Though, I'm thinking about getting rid of the entire file-capture toolchain so I'll have to leave you hanging until I've decided 100% for or against it.
@borosf on GitHub · 2026-11-30 19:03 UTC · original
Nah, that's totally fine. Ping me when you've decided. A W11 port will broaden the horizon and number of contributors.
@vktory6 on GitHub · 2026-11-30 19:04 UTC · original
I agree, I'd love to have a W11 port, but I think the most realistic way there is to have someone fork the whole repo, spend a few days getting it to feature parity on W11 and then I'll see how to reintegrate the two repos properly.
@borosf on GitHub · 2026-11-30 19:06 UTC · original
That seems like a great idea. Will work on it if I have the time 😄
@borosf on GitHub · 2026-11-30 19:24 UTC · original
Withdrawing this one - no upstream PRs from our side. Your fork-the-whole-repo route is the one we are taking: full fork, private, feature parity on Windows first, reintegration talk later. Thanks for the quick reply.
Pull request closed