go-fuzz
go-fuzz copied to clipboard
go-fuzz: set fd inheritance properly for Go 1.17+ on Windows
During Go 1.17 development, fd inheritance on Windows was changed in:
CL 288297 - "syscall: restrict inherited handles on Windows"
As a result, running go-fuzz with Go 1.17 on at least some Windows versions caused errors like:
write to testee failed: write |1: The pipe is being closed
The fix is to properly set SysProcAttr.AdditionalInheritedHandles. The fix here is modeled on the suggestion from Jason Donenfeld in a later CL 320050.
Once the unit tests were updated to run against Go 1.17 but before the fix in this PR, the unit tests failed for Windows on Go 1.17 while passing on Go 1.16. With this PR, the unit tests now pass for Windows on both Go 1.16 & 1.17.
Fixes #328
I can confirm this fixes the issue on 1.17.6 windows/amd64
Hi @dvyukov, just wanted to check in on this. Josh gave it a +1 above, and the original reporter confirmed it fixed it for them, as well as @klauspost above.
Do you want to review this as well, and/or are you OK with me merging it?
Just looking for a brief comment. Many balls in the air of course. 😅
I would move only the AdditionalInheritedHandles to separate files, the rest seems to be the same (?) so no need to duplicate.
But otherwise looks good to me.