https://bugs.winehq.org/show_bug.cgi?id=43893
Bug ID: 43893 Summary: Disable use of SHM extension through environment variable Product: Wine Version: 2.18 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: winex11.drv Assignee: wine-bugs@winehq.org Reporter: panard@inzenet.org Distribution: ---
When using wine through container systems like docker, use of MIT-SHM can provoke crashes due to some memory isolation, especially on Mac OS X or Windows (see for instance https://github.com/pauleve/docker-mtgo/issues/3 )
It would be very convenient to be able to disable the use of XShm extension by setting an environment variable, as Qt and others did (QT_X11_NO_MITSHM). Something like WINE_11_NO_MITSHM would be awesome.
Let me know if you would agree with such a feature - I can work on the patch.
https://bugs.winehq.org/show_bug.cgi?id=43893
--- Comment #1 from Alexandre Julliard julliard@winehq.org --- It's better to disable the extension in the server if it doesn't work. It's a little silly to keep it available but then request all clients to refrain from using it.
https://bugs.winehq.org/show_bug.cgi?id=43893
--- Comment #2 from Panard panard@inzenet.org --- Sure, but in our case, this is to disable only clients in a particular container, not all the clients on the host. Moreover, looking at the current code in winex11.drv/bitblt.c, if the extension is disabled on the server, create_shm_image will still make a lot of work until it gets kicked off by XShmAttach because the current implementation of XShm still enable XShmCreateImage if the extension is disabled ; therefore disabling the extension on the server will lead to very bad performances with wine.
https://bugs.winehq.org/show_bug.cgi?id=43893
--- Comment #3 from Alexandre Julliard julliard@winehq.org --- (In reply to Panard from comment #2)
Sure, but in our case, this is to disable only clients in a particular container, not all the clients on the host.
There has to be a way to fix this at the container or Xlib level instead of changing every single app.
Moreover, looking at the current code in winex11.drv/bitblt.c, if the extension is disabled on the server, create_shm_image will still make a lot of work until it gets kicked off by XShmAttach because the current implementation of XShm still enable XShmCreateImage if the extension is disabled ; therefore disabling the extension on the server will lead to very bad performances with wine.
That's work that we do anyway if the extension is available, so the performance will be pretty much unchanged.
The real performance loss will be transferring the bits instead of using shm, but an environment variable won't make any difference there.
https://bugs.winehq.org/show_bug.cgi?id=43893
--- Comment #4 from Panard panard@inzenet.org --- Created attachment 59517 --> https://bugs.winehq.org/attachment.cgi?id=59517 wine-WINE_X11_NO_MITSHM.patch
For the record, here is a patch for runtime disabling of XShm for Wine by setting envvar WINE_X11_NO_MITSHM=1. It allows to easily fix shm related issues in specific environments, without having to restrict the server features or to provides alternative binaries.
There is unfortunately no other easy way to disable XShm on client side (that's why Qt and Java both provides a similar mechanism).