https://bugs.winehq.org/show_bug.cgi?id=37669
--- Comment #13 from Sebastian Lackner sebastian@fds-team.de --- (In reply to Dmitry Timoshkov from comment #11)
(In reply to Sebastian Lackner from comment #10)
I don't agree, it could cause regressions. At the moment recvmsg just fails with EFAULT, but when you replace that with your suggested solution it will crash.
recvmsg msg fails with EFAULT when it shouldn't, and that was very hard to track down. I'd prefer it would crash instead.
Well, feel free to write a patch for your alternative solution, but I still think that checking for EFAULT, triggering write watches, and then retrying is a more clean approach.
As mentioned before, on Windows passing invalid pointers to WSA functions doesn't cause an exception.
Neither under Wine.
You should also keep in mind that there must be a reason why .NET / Silverlight uses write-watch protected pages for network buffers. I guess it is used as a fast method to determine when the async operation has been executed and new data is available. To make that fully compatible with Windows we should ideally get rid of the write watch check at the beginning of WSARecv, and only execute it when recvmsg returns EFAULT (see comments in my patch subject) - otherwise the application will check for completion multiple times.