[PATCH 2/2 v2] ntdll: Track copy-on-write memory state on i386 and x86_64 architectures.
Piotr Caban
piotr at codeweavers.com
Fri Feb 22 10:38:33 CST 2019
Hi Sebastian,
On 2/22/19 5:08 PM, Sebastian Lackner wrote:
> I didn't fully review your patch, but note that we had this feature
> basically disabled in Staging (hidden behind an environment variable)
> because it caused a lot of trouble.
>
> The main issues were:
>
> * Syscalls will just fail with EFAULT when they encounter a page
> without sufficient protections. It will not trigger a signal! This
> means it would be necessary to add code to handle EFAULT whenever
> there is a chance that the memory passed by the user might have the
> copy-on-write flag. In particular, this affects all wineserver calls
> which directly write to user-provided buffers. See:
>
> https://github.com/wine-staging/wine-staging/blob/master/patches/ntdll-WRITECOPY/0001-ntdll-Trigger-write-watches-before-passing-userdata-.patch
The code is changed in a way so it behaves exactly the same as memory
with write watch. Before executing the syscall check_write_access should
make the memory readable. I think copy-on-write EFAULT shouldn't happen
during syscall in current wine.
> * For third party libraries you always have to ensure that faults are
> handled before passing any pointer. This even affects the OpenGL libs:
> They pass memory addresses directly to the kernel, and thus don't
> trigger the write patches. We noticed weird rendering errors in
> several games with the copy-on-write logic enabled.
Do you remember any of the games that were affected? I'm expecting it to
still be a problem.
Thanks,
Piotr
More information about the wine-devel
mailing list