ntdll: Introduce new function wine_server_set_reply_user for user provided pointers.
sebastian at fds-team.de
Mon Oct 6 13:56:03 CDT 2014
This patch is an alternative strategy for fixing the issue described in http://source.winehq.org/patches/data/106864. Please note that the patches 2-4 from the previous series are still valid, and can be applied independently.
Although Andre_H and ehoover told me that this solution will not be accepted, I'll give it a try, because its the cleanest approach I can think of.
There is a huge amount of wineserver calls that use wine_server_set_reply incorrectly, and manually adding code to all these functions seems very complicated. In ntdll we have to use virtual_check_buffer_for_write, everywhere else we have to use IsBadWritePtr. And even if we have added that, it could still break things: When we add the check at the top of each affected function, and return some general error codes, it could break apps which expect a page fault exception in some other code branch.
I decided not to use virtual_check_buffer_for_write directly, but instead the same code without __TRY/__EXCEPT - this has the advantage that we don't have to think about error handling, because it doesn't change the behaviour in all the cases, that were working before. If a future app crashes inside of this check, appropriate pointer checking should be added to the calling function, and wine_server_set_reply_user can be changed back to wine_server_set_reply.
A third alternative method would be to allocate additional memory and copy stuff, but thats probably just a waste of performance.
dlls/ntdll/atom.c | 4 ++--
dlls/ntdll/ntdll.spec | 1 +
dlls/ntdll/server.c | 30 ++++++++++++++++++++++++++++++
include/wine/server.h | 1 +
4 files changed, 34 insertions(+), 2 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3880 bytes
Desc: not available
More information about the wine-patches