Repository navigation
Conversation
Could you elaborate on where we'd expect to need that fallback? |
|
Mostly sandboxes that start processes with Win32k system calls disabled ( If such a process gets to I haven't been able to hit that path, though, because anything that reaches |
391f401 to
b3e463c
Compare
Ah, sandboxes are the puzzle piece I didn't think about hard enough. I even looked up if nano server had no user32.dll, but sandboxes make sense.
That fallback might become reasonably reachable in combination with msys2/MSYS2-packages#6785 and git-for-windows/MINGW-packages#230. It might make sense to mention in the commit message that this fallback is intended for sandboxed environments with |
On Windows, poll() waits with MsgWaitForMultipleObjects() and pumps window messages with PeekMessage(), TranslateMessage() and DispatchMessage(). These are the only functions git.exe imports from user32.dll, so every Git process loads user32, and with it gdi32, gdi32full, win32u and imm32, even though most commands never call poll(). Load the four functions with the existing lazyload helpers the first time poll() runs instead. If user32 cannot be loaded, the process cannot have a message queue to pump, so wait with WaitForMultipleObjects(). That fallback is for sandboxed processes started with Win32k system calls disabled (PROCESS_CREATION_MITIGATION_POLICY_WIN32K_SYSTEM_CALL_DISABLE_ALWAYS_ON). user32.dll cannot initialize there, so today git.exe fails to start in them with 0xC0000142 before main() runs. Signed-off-by: Alexandre Zollinger Chohfi <alzollin@microsoft.com>
b3e463c to
fc94eca
Compare
|
Thanks, I've added that to the commit message. I also found a way to reach the fallback without a shell: parallel checkout waits for its |
On Windows,
poll()incompat/poll/poll.cwaits withMsgWaitForMultipleObjects()and pumpswindow messages with
PeekMessage(),TranslateMessage()andDispatchMessage(). These are theonly functions
git.exeimports from user32.dll, so every Git process loads user32, and with itgdi32, gdi32full, win32u and imm32, even though most commands never call
poll().This loads the four functions with the existing
lazyload.hhelpers the first timepoll()runs.If user32 cannot be loaded, the process cannot have a message queue to pump, so it waits with
WaitForMultipleObjects().git.exethen maps 17 images forgit --versioninstead of 23. On a Windows 11 desktop, builtfrom v2.55.0.windows.5 with and without the change, 100 interleaved runs each:
git --versiongit rev-parse --git-dirgit status --shortgit log -1 --onelinet0061-run-command,t5400-send-packandt5601-clonepass with the change, on the release andon main.
The same code is in upstream Git, so I can send it to the mailing list too if you prefer it to go
upstream first.
I used GitHub Copilot to help investigate and prepare this change. I have reviewed and tested it.