xwayland: Add support for byte-swapped clients

Instructs Xwayland to allow/disallow connections from X11 clients with a
different endianess based on the "xwayland-allow-byte-swapped-clients"
setting.

This option has no effect if Xwayland does not support the command
option +byteswappedclients/-byteswappedclients.

Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2576
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2785>
This commit is contained in:
Olivier Fourdan 2023-01-09 15:40:03 +01:00
parent 5be6e7b18e
commit 8ee85cb228
3 changed files with 22 additions and 0 deletions

View File

@ -106,3 +106,6 @@
/* Whether the Xwayland -terminate supports a delay */ /* Whether the Xwayland -terminate supports a delay */
#mesondefine HAVE_XWAYLAND_TERMINATE_DELAY #mesondefine HAVE_XWAYLAND_TERMINATE_DELAY
/* Whether the Xwayland supports +/-byteswappedclients */
#mesondefine HAVE_XWAYLAND_BYTE_SWAPPED_CLIENTS

View File

@ -536,6 +536,7 @@ endif
have_xwayland_initfd = false have_xwayland_initfd = false
have_xwayland_listenfd = false have_xwayland_listenfd = false
have_xwayland_terminate_delay = false have_xwayland_terminate_delay = false
have_xwayland_byte_swapped_clients = false
if have_xwayland if have_xwayland
xwayland_dep = dependency('xwayland', required: false) xwayland_dep = dependency('xwayland', required: false)
@ -597,6 +598,16 @@ if have_xwayland
if (have_xwayland_terminate_delay) if (have_xwayland_terminate_delay)
cdata.set('HAVE_XWAYLAND_TERMINATE_DELAY', 1) cdata.set('HAVE_XWAYLAND_TERMINATE_DELAY', 1)
endif endif
# For Xwayland +/-byteswappedclients usage
if xwayland_dep.found()
have_xwayland_byte_swapped_clients = xwayland_dep.get_variable('have_byteswappedclients',
default_value: 'false') == 'true'
endif
if (have_xwayland_byte_swapped_clients)
cdata.set('HAVE_XWAYLAND_BYTE_SWAPPED_CLIENTS', 1)
endif
endif endif
optional_functions = [ optional_functions = [
@ -678,6 +689,7 @@ summary('Profiler', have_profiler, section: 'Options')
summary('Xwayland initfd', have_xwayland_initfd, section: 'Options') summary('Xwayland initfd', have_xwayland_initfd, section: 'Options')
summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options') summary('Xwayland listenfd', have_xwayland_listenfd, section: 'Options')
summary('Xwayland terminate delay', have_xwayland_terminate_delay, section: 'Options') summary('Xwayland terminate delay', have_xwayland_terminate_delay, section: 'Options')
summary('Xwayland byte-swapped clients', have_xwayland_byte_swapped_clients, section: 'Options')
summary('Enabled', have_tests, section: 'Tests') summary('Enabled', have_tests, section: 'Tests')
summary('Core tests', have_core_tests, section: 'Tests') summary('Core tests', have_core_tests, section: 'Tests')

View File

@ -903,6 +903,13 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
args[i++] = "7"; args[i++] = "7";
#endif #endif
#ifdef HAVE_XWAYLAND_BYTE_SWAPPED_CLIENTS
if (meta_settings_are_xwayland_byte_swapped_clients_allowed (settings))
args[i++] = "+byteswappedclients";
else
args[i++] = "-byteswappedclients";
#endif
if (meta_settings_is_experimental_feature_enabled (settings, if (meta_settings_is_experimental_feature_enabled (settings,
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND)) META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND))
#ifdef HAVE_XWAYLAND_TERMINATE_DELAY #ifdef HAVE_XWAYLAND_TERMINATE_DELAY