Skip to content

Commit 1220bb4

Browse files
authored
[Xwayland] Check for listenfd option (#743)
* [Wayland] Add Xwayland byte-swapped clients support Recent versions of Xwayland can allow or disallow X11 clients from different endianess to connect. Add a setting to configure this feature from Muffin, who spawns Xwayland. Disabled by default, since this feature have potential security issues. * Use args for Xwayland and explicit disable byte swapped clients * Typo * [Xwayland] Check for listenfd option `-listen` is deprecated in modern versions of Xwayland and replaced by `-listenfd`. Use the pkg-config variable "have_listenfd" (if available) from Xwayland to determine if we should use that option, to avoid a deprecation warning when spawning Xwayland.
1 parent 3a8367f commit 1220bb4

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

config.h.meson

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,8 @@
7171
/* Whether Xwayland has -initfd option */
7272
#mesondefine HAVE_XWAYLAND_INITFD
7373

74+
/* Whether Xwayland has -listenfd option */
75+
#mesondefine HAVE_XWAYLAND_LISTENFD
76+
7477
/* Whether the Xwayland supports +/-byteswappedclients */
7578
#mesondefine HAVE_XWAYLAND_BYTE_SWAPPED_CLIENTS

meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,8 @@ if cc.has_header_symbol('sys/prctl.h', 'prctl')
376376
endif
377377

378378
have_xwayland_initfd = false
379+
have_xwayland_listenfd = false
380+
379381
have_xwayland_byte_swapped_clients = false
380382
if have_wayland
381383
xwayland_dep = dependency('xwayland', required: false)
@@ -418,6 +420,15 @@ if have_wayland
418420
cdata.set('HAVE_XWAYLAND_INITFD', 1)
419421
endif
420422

423+
# For Xwayland -listenfd usage
424+
if xwayland_dep.found()
425+
have_xwayland_listenfd = xwayland_dep.get_pkgconfig_variable('have_listenfd') == 'true'
426+
endif
427+
428+
if (have_xwayland_listenfd)
429+
cdata.set('HAVE_XWAYLAND_LISTENFD', 1)
430+
endif
431+
421432
# For Xwayland +/-byteswappedclients usage
422433
if xwayland_dep.found()
423434
have_xwayland_byte_swapped_clients = xwayland_dep.get_variable('have_byteswappedclients',
@@ -489,6 +500,7 @@ output = [
489500
' Introspection.................... ' + have_introspection.to_string(),
490501
' Profiler......................... ' + have_profiler.to_string(),
491502
' Xwayland initfd.................. ' + have_xwayland_initfd.to_string(),
503+
' Xwayland listenfd................ ' + have_xwayland_listenfd.to_string(),
492504
' Xwayland byte-swapped clients.... ' + have_xwayland_byte_swapped_clients.to_string(),
493505
'',
494506
' Tests:',

src/wayland/meta-xwayland.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
#include "wayland/meta-xwayland-surface.h"
4545
#include "x11/meta-x11-display-private.h"
4646

47+
#ifdef HAVE_XWAYLAND_LISTENFD
48+
#define XWAYLAND_LISTENFD "-listenfd"
49+
#else
50+
#define XWAYLAND_LISTENFD "-listen"
51+
#endif
52+
4753
static int display_number_override = -1;
4854

4955
static void meta_xwayland_stop_xserver (MetaXWaylandManager *manager);
@@ -640,6 +646,9 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
640646
args[i++] = "-core";
641647
args[i++] = "-auth";
642648
args[i++] = manager->auth_file;
649+
args[i++] = XWAYLAND_LISTENFD;
650+
args[i++] = "4";
651+
args[i++] = XWAYLAND_LISTENFD;
643652
args[i++] = "-listen";
644653
args[i++] = "4";
645654
args[i++] = "-listen";
@@ -650,7 +659,7 @@ meta_xwayland_start_xserver (MetaXWaylandManager *manager,
650659
args[i++] = "-initfd";
651660
args[i++] = "7";
652661
#else
653-
args[i++] = "-listen";
662+
args[i++] = XWAYLAND_LISTENFD;
654663
args[i++] = "7";
655664
#endif
656665

0 commit comments

Comments
 (0)