- More fixes from RHEL 8:
- Fix DisallowTCP=false - Fix crash when both wayland and xorg are unavailable Related: #2056931
This commit is contained in:
parent
6c2bc99f3c
commit
7c05e20e13
144
0001-meson-Fix-detection-of-Xorg-versions-that-need-liste.patch
Normal file
144
0001-meson-Fix-detection-of-Xorg-versions-that-need-liste.patch
Normal file
@ -0,0 +1,144 @@
|
||||
From b8caa1a18f284cc9b59a2e0273780a51b6fd7528 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Thu, 7 Oct 2021 18:22:11 -0700
|
||||
Subject: [PATCH 1/2] meson: Fix detection of Xorg versions that need -listen
|
||||
tcp
|
||||
|
||||
Closes #704
|
||||
---
|
||||
meson.build | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 64b98628..52ac1941 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -42,60 +42,63 @@ udev_dep = dependency('udev')
|
||||
glib_min_version = '2.56.0'
|
||||
|
||||
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
||||
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_min_version)
|
||||
gio_dep = dependency('gio-2.0', version: '>=' + glib_min_version)
|
||||
gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
||||
gtk_dep = dependency('gtk+-3.0', version: '>= 2.91.1')
|
||||
libcanberra_gtk_dep = dependency('libcanberra-gtk3', version: '>= 0.4')
|
||||
accountsservice_dep = dependency('accountsservice', version: '>= 0.6.35')
|
||||
xcb_dep = dependency('xcb')
|
||||
keyutils_dep = dependency('libkeyutils', required: false)
|
||||
libselinux_dep = dependency('libselinux', required: get_option('selinux'))
|
||||
|
||||
# udev
|
||||
if udev_dir == ''
|
||||
if udev_dep.found()
|
||||
udev_prefix = udev_dep.get_pkgconfig_variable('udevdir')
|
||||
else
|
||||
udev_prefix = gdm_prefix / 'lib' / 'udev'
|
||||
endif
|
||||
udev_dir = udev_prefix / 'rules.d'
|
||||
endif
|
||||
|
||||
# X11
|
||||
x_deps = declare_dependency(
|
||||
dependencies: [
|
||||
dependency('x11'),
|
||||
dependency('xau'),
|
||||
],
|
||||
)
|
||||
+# Xserver 1.17 & later default to -nolisten and require -listen for remote access
|
||||
+xserver_deps = dependency('xorg-server', version : '>=1.17', required : false)
|
||||
+xserver_nolisten_default = xserver_deps.found()
|
||||
find_x_server_script = find_program('build-aux/find-x-server.sh', native: true)
|
||||
find_x_server_out = run_command(find_x_server_script).stdout().strip()
|
||||
if find_x_server_out != ''
|
||||
x_bin = find_x_server_out
|
||||
x_bin_path_split = x_bin.split('/')
|
||||
i = 0
|
||||
x_path = '/'
|
||||
foreach dir : x_bin_path_split
|
||||
if i < x_bin_path_split.length() - 1
|
||||
x_path = x_path / dir
|
||||
endif
|
||||
i = i + 1
|
||||
endforeach
|
||||
else
|
||||
# what to do, what to do, this is wrong, but this just sets the
|
||||
# defaults, perhaps this user is cross compiling or some such
|
||||
x_path = '/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin'
|
||||
x_bin = '/usr/bin/X'
|
||||
endif
|
||||
xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp'))
|
||||
if xdmcp_dep.found() and get_option('tcp-wrappers')
|
||||
libwrap_dep = cc.find_library('wrap')
|
||||
endif
|
||||
# systemd
|
||||
systemd_dep = dependency('systemd')
|
||||
libsystemd_dep = dependency('libsystemd')
|
||||
if meson.version().version_compare('>= 0.53')
|
||||
systemd_multiseat_x = find_program('systemd-multi-seat-x',
|
||||
required: false,
|
||||
dirs: [
|
||||
@@ -197,60 +200,61 @@ conf.set_quoted('SYSCONFDIR', gdm_prefix / get_option('sysconfdir'))
|
||||
conf.set_quoted('BINDIR', gdm_prefix / get_option('bindir'))
|
||||
conf.set_quoted('LIBDIR', gdm_prefix / get_option('libdir'))
|
||||
conf.set_quoted('LIBEXECDIR', gdm_prefix / get_option('libexecdir'))
|
||||
conf.set_quoted('LOGDIR', get_option('log-dir'))
|
||||
conf.set_quoted('DMCONFDIR', dmconfdir)
|
||||
conf.set_quoted('GDMCONFDIR', gdmconfdir)
|
||||
conf.set_quoted('GDM_SCREENSHOT_DIR', gdm_screenshot_dir)
|
||||
conf.set_quoted('GDM_XAUTH_DIR', gdm_xauth_dir)
|
||||
conf.set_quoted('GDM_RAN_ONCE_MARKER_DIR', ran_once_marker_dir)
|
||||
conf.set_quoted('GDM_RUN_DIR', gdm_run_dir)
|
||||
conf.set_quoted('GNOMELOCALEDIR', gdm_prefix / get_option('localedir'))
|
||||
conf.set_quoted('AT_SPI_REGISTRYD_DIR', at_spi_registryd_dir)
|
||||
conf.set_quoted('GDM_PID_FILE', gdm_pid_file)
|
||||
conf.set_quoted('GNOME_SETTINGS_DAEMON_DIR', gnome_settings_daemon_dir)
|
||||
conf.set_quoted('LANG_CONFIG_FILE', lang_config_file)
|
||||
conf.set('HAVE_ADT', have_adt)
|
||||
conf.set('HAVE_UTMP_H', have_utmp_header)
|
||||
conf.set('HAVE_UTMPX_H', have_utmpx_header)
|
||||
conf.set('HAVE_POSIX_GETPWNAM_R', have_posix_getpwnam_r)
|
||||
conf.set('UTMP', utmp_struct)
|
||||
conf.set('HAVE_GETUTXENT', cc.has_function('getutxent'))
|
||||
conf.set('HAVE_UPDWTMP', cc.has_function('updwtmp'))
|
||||
conf.set('HAVE_UPDWTMPX', cc.has_function('updwtmpx'))
|
||||
conf.set('HAVE_LOGIN', cc.has_function('login', args: '-lutil'))
|
||||
conf.set('HAVE_LOGOUT', cc.has_function('logout', args: '-lutil'))
|
||||
conf.set('HAVE_LOGWTMP', cc.has_function('logwtmp', args: '-lutil'))
|
||||
conf.set('HAVE_PAM_SYSLOG', have_pam_syslog)
|
||||
conf.set('HAVE_KEYUTILS', keyutils_dep.found())
|
||||
conf.set('SUPPORTS_PAM_EXTENSIONS', pam_extensions_supported)
|
||||
conf.set('HAVE_SELINUX', libselinux_dep.found())
|
||||
+conf.set('HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY', xserver_nolisten_default)
|
||||
conf.set('ENABLE_USER_DISPLAY_SERVER', get_option('user-display-server'))
|
||||
conf.set('ENABLE_SYSTEMD_JOURNAL', get_option('systemd-journal'))
|
||||
conf.set('ENABLE_WAYLAND_SUPPORT', get_option('wayland-support'))
|
||||
conf.set('ENABLE_PROFILING', get_option('profiling'))
|
||||
conf.set('GDM_INITIAL_VT', get_option('initial-vt'))
|
||||
conf.set_quoted('GDM_DEFAULTS_CONF', gdm_defaults_conf)
|
||||
conf.set_quoted('GDM_CUSTOM_CONF', gdm_custom_conf)
|
||||
conf.set_quoted('GDM_RUNTIME_CONF', gdm_runtime_conf)
|
||||
conf.set_quoted('GDM_SESSION_DEFAULT_PATH', get_option('default-path'))
|
||||
conf.set_quoted('GDM_USERNAME', get_option('user'))
|
||||
conf.set_quoted('GDM_GROUPNAME', get_option('group'))
|
||||
conf.set('HAVE_LIBXDMCP', xdmcp_dep.found())
|
||||
conf.set_quoted('SYSTEMD_X_SERVER', systemd_x_server)
|
||||
conf.set('WITH_PLYMOUTH', plymouth_dep.found())
|
||||
conf.set_quoted('X_SERVER', x_bin)
|
||||
conf.set_quoted('X_PATH', x_path)
|
||||
conf.set('HAVE_UT_UT_HOST', utmp_has_host_field)
|
||||
conf.set('HAVE_UT_UT_PID', utmp_has_pid_field)
|
||||
conf.set('HAVE_UT_UT_ID', utmp_has_id_field)
|
||||
conf.set('HAVE_UT_UT_NAME', utmp_has_name_field)
|
||||
conf.set('HAVE_UT_UT_TYPE', utmp_has_type_field)
|
||||
conf.set('HAVE_UT_UT_EXIT_E_TERMINATION', utmp_has_exit_e_termination_field)
|
||||
conf.set('HAVE_UT_UT_USER', utmp_has_user_field)
|
||||
conf.set('HAVE_UT_UT_TIME', utmp_has_time_field)
|
||||
conf.set('HAVE_UT_UT_TV', utmp_has_tv_field)
|
||||
conf.set('HAVE_UT_UT_SYSLEN', utmp_has_syslen_field)
|
||||
conf.set('ENABLE_IPV6', get_option('ipv6'))
|
||||
configure_file(output: 'config.h', configuration: conf)
|
||||
|
||||
# Subdirs
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 984690b76527baae0f7da0af00467669b49886ef Mon Sep 17 00:00:00 2001
|
||||
From 36b9fd4f6e055e236175979d9a1527df71aeac1f Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Tue, 14 Sep 2021 11:00:33 -0400
|
||||
Subject: [PATCH 1/3] xdmcp-display-factory: Set supported session types for
|
||||
Subject: [PATCH 1/5] xdmcp-display-factory: Set supported session types for
|
||||
XDMCP displays
|
||||
|
||||
The lower levels of GDM now expect the session types supported by a
|
||||
@ -118,5 +118,5 @@ index ce8f026e..abb58fae 100644
|
||||
ARRAY8Ptr authorization_data)
|
||||
{
|
||||
--
|
||||
2.31.1
|
||||
2.34.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 1e877db3a4a8cb8e4eb4fbdaef3f6a7434e6a57d Mon Sep 17 00:00:00 2001
|
||||
From b09ab8a73d5a4133f72846d529bbbfb7802ca535 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Mon, 6 Sep 2021 08:40:46 -0400
|
||||
Subject: [PATCH 2/3] daemon: Don't update session type if no saved session
|
||||
Subject: [PATCH 2/5] daemon: Don't update session type if no saved session
|
||||
|
||||
At the moment we always set the session type when the session name
|
||||
is read. But users don't always have a session type specified.
|
||||
@ -105,5 +105,5 @@ index 2b941e5e..b54687d5 100644
|
||||
}
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
2.34.1
|
||||
|
||||
|
327
0002-daemon-Support-X-servers-built-with-Dlisten_tcp-true.patch
Normal file
327
0002-daemon-Support-X-servers-built-with-Dlisten_tcp-true.patch
Normal file
@ -0,0 +1,327 @@
|
||||
From cc67c8de39358031fddc5ca7d8c993271d6606a7 Mon Sep 17 00:00:00 2001
|
||||
From: Alan Coopersmith <alan.coopersmith@oracle.com>
|
||||
Date: Thu, 7 Oct 2021 18:22:11 -0700
|
||||
Subject: [PATCH 2/2] daemon: Support X servers built with -Dlisten_tcp=true
|
||||
|
||||
Xorg since version 1.17 doesn't listen to tcp sockets by default
|
||||
unless it's explicitly built with -Dlisten_tcp=true.
|
||||
|
||||
GDM currently assumes X servers 1.17 and later are always built
|
||||
without specifying -Dlisten_tcp=true and doesn't work properly
|
||||
otherwise.
|
||||
|
||||
This commit enhances GDM to better handle these non-standard builds by
|
||||
always passing '-nolisten tcp' on the command line when tcp should
|
||||
be disabled, and likewise always passing '-listen tcp' on the command
|
||||
line, assuming the X server is new enough to support it, when tcp
|
||||
should be enabled.
|
||||
|
||||
Related #704
|
||||
---
|
||||
daemon/gdm-server.c | 21 +++++++++++----------
|
||||
daemon/gdm-x-session.c | 12 ++++++------
|
||||
meson.build | 4 ++--
|
||||
3 files changed, 19 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/daemon/gdm-server.c b/daemon/gdm-server.c
|
||||
index 1ba00d45..e5d23521 100644
|
||||
--- a/daemon/gdm-server.c
|
||||
+++ b/daemon/gdm-server.c
|
||||
@@ -290,72 +290,73 @@ gdm_server_resolve_command_line (GdmServer *server,
|
||||
if (strcmp (arg, "-query") == 0 ||
|
||||
strcmp (arg, "-indirect") == 0)
|
||||
query_in_arglist = TRUE;
|
||||
}
|
||||
|
||||
argv = g_renew (char *, argv, len + 12);
|
||||
/* shift args down one */
|
||||
for (i = len - 1; i >= 1; i--) {
|
||||
argv[i+1] = argv[i];
|
||||
}
|
||||
|
||||
/* server number is the FIRST argument, before any others */
|
||||
argv[1] = g_strdup (server->display_name);
|
||||
len++;
|
||||
|
||||
if (server->auth_file != NULL) {
|
||||
argv[len++] = g_strdup ("-auth");
|
||||
argv[len++] = g_strdup (server->auth_file);
|
||||
}
|
||||
|
||||
if (server->display_seat_id != NULL) {
|
||||
argv[len++] = g_strdup ("-seat");
|
||||
argv[len++] = g_strdup (server->display_seat_id);
|
||||
}
|
||||
|
||||
/* If we were compiled with Xserver >= 1.17 we need to specify
|
||||
* '-listen tcp' as the X server dosen't listen on tcp sockets
|
||||
* by default anymore. In older versions we need to pass
|
||||
* -nolisten tcp to disable listening on tcp sockets.
|
||||
*/
|
||||
-#ifdef HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY
|
||||
- if (!server->disable_tcp && ! query_in_arglist) {
|
||||
- argv[len++] = g_strdup ("-listen");
|
||||
- argv[len++] = g_strdup ("tcp");
|
||||
- }
|
||||
-#else
|
||||
- if (server->disable_tcp && ! query_in_arglist) {
|
||||
- argv[len++] = g_strdup ("-nolisten");
|
||||
- argv[len++] = g_strdup ("tcp");
|
||||
- }
|
||||
+ if (!query_in_arglist) {
|
||||
+ if (server->disable_tcp) {
|
||||
+ argv[len++] = g_strdup ("-nolisten");
|
||||
+ argv[len++] = g_strdup ("tcp");
|
||||
+ }
|
||||
|
||||
+#ifdef HAVE_XSERVER_WITH_LISTEN
|
||||
+ if (!server->disable_tcp) {
|
||||
+ argv[len++] = g_strdup ("-listen");
|
||||
+ argv[len++] = g_strdup ("tcp");
|
||||
+ }
|
||||
#endif
|
||||
+ }
|
||||
|
||||
if (vtarg != NULL && ! gotvtarg) {
|
||||
argv[len++] = g_strdup (vtarg);
|
||||
}
|
||||
|
||||
argv[len++] = NULL;
|
||||
|
||||
*argvp = argv;
|
||||
*argcp = len;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
rotate_logs (const char *path,
|
||||
guint n_copies)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = n_copies - 1; i > 0; i--) {
|
||||
char *name_n;
|
||||
char *name_n1;
|
||||
|
||||
name_n = g_strdup_printf ("%s.%d", path, i);
|
||||
if (i > 1) {
|
||||
name_n1 = g_strdup_printf ("%s.%d", path, i - 1);
|
||||
} else {
|
||||
name_n1 = g_strdup (path);
|
||||
}
|
||||
|
||||
diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c
|
||||
index 5962da57..0b07ab5b 100644
|
||||
--- a/daemon/gdm-x-session.c
|
||||
+++ b/daemon/gdm-x-session.c
|
||||
@@ -233,70 +233,70 @@ spawn_x_server (State *state,
|
||||
|
||||
if (g_getenv ("XDG_VTNR") != NULL) {
|
||||
int vt;
|
||||
|
||||
vt = atoi (g_getenv ("XDG_VTNR"));
|
||||
|
||||
if (vt > 0 && vt < 64) {
|
||||
vt_string = g_strdup_printf ("vt%d", vt);
|
||||
}
|
||||
}
|
||||
|
||||
display_fd_string = g_strdup_printf ("%d", DISPLAY_FILENO);
|
||||
|
||||
g_ptr_array_add (arguments, X_SERVER);
|
||||
|
||||
if (vt_string != NULL) {
|
||||
g_ptr_array_add (arguments, vt_string);
|
||||
}
|
||||
|
||||
g_ptr_array_add (arguments, "-displayfd");
|
||||
g_ptr_array_add (arguments, display_fd_string);
|
||||
|
||||
g_ptr_array_add (arguments, "-auth");
|
||||
g_ptr_array_add (arguments, auth_file);
|
||||
|
||||
/* If we were compiled with Xserver >= 1.17 we need to specify
|
||||
* '-listen tcp' as the X server doesn't listen on tcp sockets
|
||||
* by default anymore. In older versions we need to pass
|
||||
* -nolisten tcp to disable listening on tcp sockets.
|
||||
*/
|
||||
-#ifdef HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY
|
||||
- if (allow_remote_connections) {
|
||||
- g_ptr_array_add (arguments, "-listen");
|
||||
- g_ptr_array_add (arguments, "tcp");
|
||||
- }
|
||||
-#else
|
||||
if (!allow_remote_connections) {
|
||||
g_ptr_array_add (arguments, "-nolisten");
|
||||
g_ptr_array_add (arguments, "tcp");
|
||||
}
|
||||
+
|
||||
+#ifdef HAVE_XSERVER_WITH_LISTEN
|
||||
+ if (allow_remote_connections) {
|
||||
+ g_ptr_array_add (arguments, "-listen");
|
||||
+ g_ptr_array_add (arguments, "tcp");
|
||||
+ }
|
||||
#endif
|
||||
|
||||
g_ptr_array_add (arguments, "-background");
|
||||
g_ptr_array_add (arguments, "none");
|
||||
|
||||
g_ptr_array_add (arguments, "-noreset");
|
||||
g_ptr_array_add (arguments, "-keeptty");
|
||||
g_ptr_array_add (arguments, "-novtswitch");
|
||||
|
||||
g_ptr_array_add (arguments, "-verbose");
|
||||
if (state->debug_enabled) {
|
||||
g_ptr_array_add (arguments, "7");
|
||||
} else {
|
||||
g_ptr_array_add (arguments, "3");
|
||||
}
|
||||
|
||||
if (state->debug_enabled) {
|
||||
g_ptr_array_add (arguments, "-core");
|
||||
}
|
||||
g_ptr_array_add (arguments, NULL);
|
||||
|
||||
subprocess = g_subprocess_launcher_spawnv (launcher,
|
||||
(const char * const *) arguments->pdata,
|
||||
&error);
|
||||
g_free (display_fd_string);
|
||||
g_clear_object (&launcher);
|
||||
g_ptr_array_free (arguments, TRUE);
|
||||
|
||||
if (subprocess == NULL) {
|
||||
g_debug ("could not start X server: %s", error->message);
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 52ac1941..02d609dc 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -44,61 +44,61 @@ glib_min_version = '2.56.0'
|
||||
glib_dep = dependency('glib-2.0', version: '>=' + glib_min_version)
|
||||
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_min_version)
|
||||
gio_dep = dependency('gio-2.0', version: '>=' + glib_min_version)
|
||||
gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version)
|
||||
gtk_dep = dependency('gtk+-3.0', version: '>= 2.91.1')
|
||||
libcanberra_gtk_dep = dependency('libcanberra-gtk3', version: '>= 0.4')
|
||||
accountsservice_dep = dependency('accountsservice', version: '>= 0.6.35')
|
||||
xcb_dep = dependency('xcb')
|
||||
keyutils_dep = dependency('libkeyutils', required: false)
|
||||
libselinux_dep = dependency('libselinux', required: get_option('selinux'))
|
||||
|
||||
# udev
|
||||
if udev_dir == ''
|
||||
if udev_dep.found()
|
||||
udev_prefix = udev_dep.get_pkgconfig_variable('udevdir')
|
||||
else
|
||||
udev_prefix = gdm_prefix / 'lib' / 'udev'
|
||||
endif
|
||||
udev_dir = udev_prefix / 'rules.d'
|
||||
endif
|
||||
|
||||
# X11
|
||||
x_deps = declare_dependency(
|
||||
dependencies: [
|
||||
dependency('x11'),
|
||||
dependency('xau'),
|
||||
],
|
||||
)
|
||||
# Xserver 1.17 & later default to -nolisten and require -listen for remote access
|
||||
xserver_deps = dependency('xorg-server', version : '>=1.17', required : false)
|
||||
-xserver_nolisten_default = xserver_deps.found()
|
||||
+xserver_has_listen = xserver_deps.found()
|
||||
find_x_server_script = find_program('build-aux/find-x-server.sh', native: true)
|
||||
find_x_server_out = run_command(find_x_server_script).stdout().strip()
|
||||
if find_x_server_out != ''
|
||||
x_bin = find_x_server_out
|
||||
x_bin_path_split = x_bin.split('/')
|
||||
i = 0
|
||||
x_path = '/'
|
||||
foreach dir : x_bin_path_split
|
||||
if i < x_bin_path_split.length() - 1
|
||||
x_path = x_path / dir
|
||||
endif
|
||||
i = i + 1
|
||||
endforeach
|
||||
else
|
||||
# what to do, what to do, this is wrong, but this just sets the
|
||||
# defaults, perhaps this user is cross compiling or some such
|
||||
x_path = '/usr/bin/X11:/usr/X11R6/bin:/opt/X11R6/bin'
|
||||
x_bin = '/usr/bin/X'
|
||||
endif
|
||||
xdmcp_dep = cc.find_library('Xdmcp', required: get_option('xdmcp'))
|
||||
if xdmcp_dep.found() and get_option('tcp-wrappers')
|
||||
libwrap_dep = cc.find_library('wrap')
|
||||
endif
|
||||
# systemd
|
||||
systemd_dep = dependency('systemd')
|
||||
libsystemd_dep = dependency('libsystemd')
|
||||
if meson.version().version_compare('>= 0.53')
|
||||
systemd_multiseat_x = find_program('systemd-multi-seat-x',
|
||||
required: false,
|
||||
dirs: [
|
||||
@@ -200,61 +200,61 @@ conf.set_quoted('SYSCONFDIR', gdm_prefix / get_option('sysconfdir'))
|
||||
conf.set_quoted('BINDIR', gdm_prefix / get_option('bindir'))
|
||||
conf.set_quoted('LIBDIR', gdm_prefix / get_option('libdir'))
|
||||
conf.set_quoted('LIBEXECDIR', gdm_prefix / get_option('libexecdir'))
|
||||
conf.set_quoted('LOGDIR', get_option('log-dir'))
|
||||
conf.set_quoted('DMCONFDIR', dmconfdir)
|
||||
conf.set_quoted('GDMCONFDIR', gdmconfdir)
|
||||
conf.set_quoted('GDM_SCREENSHOT_DIR', gdm_screenshot_dir)
|
||||
conf.set_quoted('GDM_XAUTH_DIR', gdm_xauth_dir)
|
||||
conf.set_quoted('GDM_RAN_ONCE_MARKER_DIR', ran_once_marker_dir)
|
||||
conf.set_quoted('GDM_RUN_DIR', gdm_run_dir)
|
||||
conf.set_quoted('GNOMELOCALEDIR', gdm_prefix / get_option('localedir'))
|
||||
conf.set_quoted('AT_SPI_REGISTRYD_DIR', at_spi_registryd_dir)
|
||||
conf.set_quoted('GDM_PID_FILE', gdm_pid_file)
|
||||
conf.set_quoted('GNOME_SETTINGS_DAEMON_DIR', gnome_settings_daemon_dir)
|
||||
conf.set_quoted('LANG_CONFIG_FILE', lang_config_file)
|
||||
conf.set('HAVE_ADT', have_adt)
|
||||
conf.set('HAVE_UTMP_H', have_utmp_header)
|
||||
conf.set('HAVE_UTMPX_H', have_utmpx_header)
|
||||
conf.set('HAVE_POSIX_GETPWNAM_R', have_posix_getpwnam_r)
|
||||
conf.set('UTMP', utmp_struct)
|
||||
conf.set('HAVE_GETUTXENT', cc.has_function('getutxent'))
|
||||
conf.set('HAVE_UPDWTMP', cc.has_function('updwtmp'))
|
||||
conf.set('HAVE_UPDWTMPX', cc.has_function('updwtmpx'))
|
||||
conf.set('HAVE_LOGIN', cc.has_function('login', args: '-lutil'))
|
||||
conf.set('HAVE_LOGOUT', cc.has_function('logout', args: '-lutil'))
|
||||
conf.set('HAVE_LOGWTMP', cc.has_function('logwtmp', args: '-lutil'))
|
||||
conf.set('HAVE_PAM_SYSLOG', have_pam_syslog)
|
||||
conf.set('HAVE_KEYUTILS', keyutils_dep.found())
|
||||
conf.set('SUPPORTS_PAM_EXTENSIONS', pam_extensions_supported)
|
||||
conf.set('HAVE_SELINUX', libselinux_dep.found())
|
||||
-conf.set('HAVE_XSERVER_THAT_DEFAULTS_TO_LOCAL_ONLY', xserver_nolisten_default)
|
||||
+conf.set('HAVE_XSERVER_WITH_LISTEN', xserver_has_listen)
|
||||
conf.set('ENABLE_USER_DISPLAY_SERVER', get_option('user-display-server'))
|
||||
conf.set('ENABLE_SYSTEMD_JOURNAL', get_option('systemd-journal'))
|
||||
conf.set('ENABLE_WAYLAND_SUPPORT', get_option('wayland-support'))
|
||||
conf.set('ENABLE_PROFILING', get_option('profiling'))
|
||||
conf.set('GDM_INITIAL_VT', get_option('initial-vt'))
|
||||
conf.set_quoted('GDM_DEFAULTS_CONF', gdm_defaults_conf)
|
||||
conf.set_quoted('GDM_CUSTOM_CONF', gdm_custom_conf)
|
||||
conf.set_quoted('GDM_RUNTIME_CONF', gdm_runtime_conf)
|
||||
conf.set_quoted('GDM_SESSION_DEFAULT_PATH', get_option('default-path'))
|
||||
conf.set_quoted('GDM_USERNAME', get_option('user'))
|
||||
conf.set_quoted('GDM_GROUPNAME', get_option('group'))
|
||||
conf.set('HAVE_LIBXDMCP', xdmcp_dep.found())
|
||||
conf.set_quoted('SYSTEMD_X_SERVER', systemd_x_server)
|
||||
conf.set('WITH_PLYMOUTH', plymouth_dep.found())
|
||||
conf.set_quoted('X_SERVER', x_bin)
|
||||
conf.set_quoted('X_PATH', x_path)
|
||||
conf.set('HAVE_UT_UT_HOST', utmp_has_host_field)
|
||||
conf.set('HAVE_UT_UT_PID', utmp_has_pid_field)
|
||||
conf.set('HAVE_UT_UT_ID', utmp_has_id_field)
|
||||
conf.set('HAVE_UT_UT_NAME', utmp_has_name_field)
|
||||
conf.set('HAVE_UT_UT_TYPE', utmp_has_type_field)
|
||||
conf.set('HAVE_UT_UT_EXIT_E_TERMINATION', utmp_has_exit_e_termination_field)
|
||||
conf.set('HAVE_UT_UT_USER', utmp_has_user_field)
|
||||
conf.set('HAVE_UT_UT_TIME', utmp_has_time_field)
|
||||
conf.set('HAVE_UT_UT_TV', utmp_has_tv_field)
|
||||
conf.set('HAVE_UT_UT_SYSLEN', utmp_has_syslen_field)
|
||||
conf.set('ENABLE_IPV6', get_option('ipv6'))
|
||||
configure_file(output: 'config.h', configuration: conf)
|
||||
|
||||
# Subdirs
|
||||
--
|
||||
2.34.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 3eea287750d63cfe94fe777111e1cd04141eecb3 Mon Sep 17 00:00:00 2001
|
||||
From 7084aea50bdc16ccecb4474ca79403429e79ec0e Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Wed, 29 Sep 2021 11:03:41 -0400
|
||||
Subject: [PATCH 3/3] daemon: Infer session type from desktop file if user has
|
||||
Subject: [PATCH 3/5] daemon: Infer session type from desktop file if user has
|
||||
no saved session type
|
||||
|
||||
The accountsservice user cache file can specify a session type
|
||||
@ -83,5 +83,5 @@ index b54687d5..a65fa0f9 100644
|
||||
if (conversation->worker_pid == pid) {
|
||||
return conversation;
|
||||
--
|
||||
2.31.1
|
||||
2.34.1
|
||||
|
||||
|
559
0004-daemon-Consolidate-session-type-and-supported-sessio.patch
Normal file
559
0004-daemon-Consolidate-session-type-and-supported-sessio.patch
Normal file
@ -0,0 +1,559 @@
|
||||
From d76d6ff0761d47df938f1dab0daeeecac2feb56e Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Mon, 6 Sep 2021 08:43:28 -0400
|
||||
Subject: [PATCH 4/5] daemon: Consolidate session-type and
|
||||
supported-session-types list
|
||||
|
||||
There's currently a bug in computing the session-type to use.
|
||||
|
||||
The `i > 0` check means wayland will overwrite x11 in the
|
||||
transient session type list.
|
||||
|
||||
Morever, the separation between "session-type" and
|
||||
"supported-session-types" is a little redundant. Since
|
||||
supported-session-types is a sorted list, the first item should
|
||||
always be the same as "session-type".
|
||||
|
||||
This commit addresses the bug and the redundant logic, by computing
|
||||
the supported session types early in the function and indexing into
|
||||
it to get the session-type.
|
||||
|
||||
A future cleanup could probably get rid of session-type entirely.
|
||||
|
||||
https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/153
|
||||
---
|
||||
daemon/gdm-local-display-factory.c | 193 +++++++++++++++++------------
|
||||
1 file changed, 116 insertions(+), 77 deletions(-)
|
||||
|
||||
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
|
||||
index 141d64c6..eba38671 100644
|
||||
--- a/daemon/gdm-local-display-factory.c
|
||||
+++ b/daemon/gdm-local-display-factory.c
|
||||
@@ -197,164 +197,226 @@ get_preferred_display_server (GdmLocalDisplayFactory *factory)
|
||||
}
|
||||
|
||||
if (!wayland_enabled && !xorg_enabled) {
|
||||
return g_strdup ("none");
|
||||
}
|
||||
|
||||
gdm_settings_direct_get_string (GDM_KEY_PREFERRED_DISPLAY_SERVER, &preferred_display_server);
|
||||
|
||||
if (g_strcmp0 (preferred_display_server, "wayland") == 0) {
|
||||
if (wayland_enabled)
|
||||
return g_strdup (preferred_display_server);
|
||||
else
|
||||
return g_strdup ("xorg");
|
||||
}
|
||||
|
||||
if (g_strcmp0 (preferred_display_server, "xorg") == 0) {
|
||||
if (xorg_enabled)
|
||||
return g_strdup (preferred_display_server);
|
||||
else
|
||||
return g_strdup ("wayland");
|
||||
}
|
||||
|
||||
if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) {
|
||||
if (xorg_enabled)
|
||||
return g_strdup (preferred_display_server);
|
||||
}
|
||||
|
||||
return g_strdup ("none");
|
||||
}
|
||||
|
||||
+struct GdmDisplayServerConfiguration {
|
||||
+ const char *display_server;
|
||||
+ const char *key;
|
||||
+ const char *binary;
|
||||
+ const char *session_type;
|
||||
+} display_server_configuration[] = {
|
||||
+#ifdef ENABLE_WAYLAND_SUPPORT
|
||||
+ { "wayland", GDM_KEY_WAYLAND_ENABLE, "/usr/bin/Xwayland", "wayland" },
|
||||
+#endif
|
||||
+ { "xorg", GDM_KEY_XORG_ENABLE, "/usr/bin/Xorg", "x11" },
|
||||
+ { NULL, NULL, NULL },
|
||||
+};
|
||||
+
|
||||
+static gboolean
|
||||
+display_server_enabled (GdmLocalDisplayFactory *factory,
|
||||
+ const char *display_server)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; display_server_configuration[i].display_server != NULL; i++) {
|
||||
+ const char *key = display_server_configuration[i].key;
|
||||
+ const char *binary = display_server_configuration[i].binary;
|
||||
+ gboolean enabled = FALSE;
|
||||
+
|
||||
+ if (!g_str_equal (display_server_configuration[i].display_server,
|
||||
+ display_server))
|
||||
+ continue;
|
||||
+
|
||||
+ if (!gdm_settings_direct_get_boolean (key, &enabled) || !enabled)
|
||||
+ return FALSE;
|
||||
+
|
||||
+ if (!g_file_test (binary, G_FILE_TEST_IS_EXECUTABLE))
|
||||
+ return FALSE;
|
||||
+
|
||||
+ return TRUE;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
static const char *
|
||||
-gdm_local_display_factory_get_session_type (GdmLocalDisplayFactory *factory,
|
||||
- gboolean should_fall_back)
|
||||
+get_session_type_for_display_server (GdmLocalDisplayFactory *factory,
|
||||
+ const char *display_server)
|
||||
+{
|
||||
+ size_t i;
|
||||
+
|
||||
+ for (i = 0; display_server_configuration[i].display_server != NULL; i++) {
|
||||
+ if (!g_str_equal (display_server_configuration[i].display_server,
|
||||
+ display_server))
|
||||
+ continue;
|
||||
+
|
||||
+ return display_server_configuration[i].session_type;
|
||||
+ }
|
||||
+
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static char **
|
||||
+gdm_local_display_factory_get_session_types (GdmLocalDisplayFactory *factory,
|
||||
+ gboolean should_fall_back)
|
||||
{
|
||||
- const char *session_types[3] = { NULL };
|
||||
- gsize i, session_type_index = 0;
|
||||
g_autofree gchar *preferred_display_server = NULL;
|
||||
+ const char *fallback_display_server = NULL;
|
||||
+ gboolean wayland_preferred = FALSE;
|
||||
+ gboolean xorg_preferred = FALSE;
|
||||
+ g_autoptr (GPtrArray) session_types_array = NULL;
|
||||
+ char **session_types;
|
||||
+
|
||||
+ session_types_array = g_ptr_array_new ();
|
||||
|
||||
preferred_display_server = get_preferred_display_server (factory);
|
||||
|
||||
- if (g_strcmp0 (preferred_display_server, "wayland") != 0 &&
|
||||
- g_strcmp0 (preferred_display_server, "xorg") != 0)
|
||||
- return NULL;
|
||||
+ g_debug ("GdmLocalDisplayFactory: Getting session type (prefers %s, falling back: %s)",
|
||||
+ preferred_display_server, should_fall_back? "yes" : "no");
|
||||
|
||||
- for (i = 0; i < G_N_ELEMENTS (session_types) - 1; i++) {
|
||||
-#ifdef ENABLE_WAYLAND_SUPPORT
|
||||
- if (i > 0 ||
|
||||
- g_strcmp0 (preferred_display_server, "wayland") == 0) {
|
||||
- gboolean wayland_enabled = FALSE;
|
||||
- if (gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled)) {
|
||||
- if (wayland_enabled && g_file_test ("/usr/bin/Xwayland", G_FILE_TEST_IS_EXECUTABLE)) {
|
||||
- session_types[i] = "wayland";
|
||||
- continue;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
-#endif
|
||||
+ wayland_preferred = g_str_equal (preferred_display_server, "wayland");
|
||||
+ xorg_preferred = g_str_equal (preferred_display_server, "xorg");
|
||||
+
|
||||
+ if (wayland_preferred)
|
||||
+ fallback_display_server = "xorg";
|
||||
+ else if (xorg_preferred)
|
||||
+ fallback_display_server = "wayland";
|
||||
+ else
|
||||
+ return NULL;
|
||||
|
||||
- if (i > 0 ||
|
||||
- g_strcmp0 (preferred_display_server, "xorg") == 0) {
|
||||
- gboolean xorg_enabled = FALSE;
|
||||
- if (gdm_settings_direct_get_boolean (GDM_KEY_XORG_ENABLE, &xorg_enabled)) {
|
||||
- if (xorg_enabled && g_file_test ("/usr/bin/Xorg", G_FILE_TEST_IS_EXECUTABLE)) {
|
||||
- session_types[i] = "x11";
|
||||
- continue;
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
+ if (!should_fall_back) {
|
||||
+ if (display_server_enabled (factory, preferred_display_server))
|
||||
+ g_ptr_array_add (session_types_array, (gpointer) get_session_type_for_display_server (factory, preferred_display_server));
|
||||
}
|
||||
|
||||
- if (should_fall_back)
|
||||
- session_type_index++;
|
||||
+ if (display_server_enabled (factory, fallback_display_server))
|
||||
+ g_ptr_array_add (session_types_array, (gpointer) get_session_type_for_display_server (factory, fallback_display_server));
|
||||
|
||||
- return session_types[session_type_index];
|
||||
+ if (session_types_array->len == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ g_ptr_array_add (session_types_array, NULL);
|
||||
+
|
||||
+ session_types = g_strdupv ((char **) session_types_array->pdata);
|
||||
+
|
||||
+ return session_types;
|
||||
}
|
||||
|
||||
static void
|
||||
on_display_disposed (GdmLocalDisplayFactory *factory,
|
||||
GdmDisplay *display)
|
||||
{
|
||||
g_debug ("GdmLocalDisplayFactory: Display %p disposed", display);
|
||||
}
|
||||
|
||||
static void
|
||||
store_display (GdmLocalDisplayFactory *factory,
|
||||
GdmDisplay *display)
|
||||
{
|
||||
GdmDisplayStore *store;
|
||||
|
||||
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
|
||||
gdm_display_store_add (store, display);
|
||||
}
|
||||
|
||||
/*
|
||||
Example:
|
||||
dbus-send --system --dest=org.gnome.DisplayManager \
|
||||
--type=method_call --print-reply --reply-timeout=2000 \
|
||||
/org/gnome/DisplayManager/Manager \
|
||||
org.gnome.DisplayManager.Manager.GetDisplays
|
||||
*/
|
||||
gboolean
|
||||
gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *factory,
|
||||
char **id,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret;
|
||||
GdmDisplay *display = NULL;
|
||||
gboolean is_initial = FALSE;
|
||||
const char *session_type;
|
||||
g_autofree gchar *preferred_display_server = NULL;
|
||||
|
||||
g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE);
|
||||
|
||||
ret = FALSE;
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: Creating transient display");
|
||||
|
||||
preferred_display_server = get_preferred_display_server (factory);
|
||||
|
||||
#ifdef ENABLE_USER_DISPLAY_SERVER
|
||||
if (g_strcmp0 (preferred_display_server, "wayland") == 0 ||
|
||||
g_strcmp0 (preferred_display_server, "xorg") == 0) {
|
||||
- session_type = gdm_local_display_factory_get_session_type (factory, FALSE);
|
||||
+ g_auto(GStrv) session_types = NULL;
|
||||
|
||||
- if (session_type == NULL) {
|
||||
+ session_types = gdm_local_display_factory_get_session_types (factory, FALSE);
|
||||
+
|
||||
+ if (session_types == NULL) {
|
||||
g_set_error_literal (error,
|
||||
GDM_DISPLAY_ERROR,
|
||||
GDM_DISPLAY_ERROR_GENERAL,
|
||||
"Both Wayland and Xorg are unavailable");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
display = gdm_local_display_new ();
|
||||
- g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
|
||||
+ g_object_set (G_OBJECT (display),
|
||||
+ "session-type", session_types[0],
|
||||
+ "supported-session-tyes", session_types,
|
||||
+ NULL);
|
||||
is_initial = TRUE;
|
||||
}
|
||||
#endif
|
||||
if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0) {
|
||||
if (display == NULL) {
|
||||
guint32 num;
|
||||
|
||||
num = take_next_display_number (factory);
|
||||
|
||||
display = gdm_legacy_display_new (num);
|
||||
}
|
||||
}
|
||||
|
||||
if (display == NULL) {
|
||||
g_set_error_literal (error,
|
||||
GDM_DISPLAY_ERROR,
|
||||
GDM_DISPLAY_ERROR_GENERAL,
|
||||
"Invalid preferred display server configured");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_object_set (display,
|
||||
"seat-id", "seat0",
|
||||
"allow-timed-login", FALSE,
|
||||
"is-initial", is_initial,
|
||||
NULL);
|
||||
|
||||
store_display (factory, display);
|
||||
|
||||
if (! gdm_display_manage (display)) {
|
||||
@@ -549,243 +611,220 @@ lookup_prepared_display_by_seat_id (const char *id,
|
||||
|
||||
if (status != GDM_DISPLAY_PREPARED)
|
||||
return FALSE;
|
||||
|
||||
return lookup_by_seat_id (id, display, user_data);
|
||||
}
|
||||
|
||||
static int
|
||||
on_seat0_graphics_check_timeout (gpointer user_data)
|
||||
{
|
||||
GdmLocalDisplayFactory *factory = user_data;
|
||||
|
||||
factory->seat0_graphics_check_timeout_id = 0;
|
||||
|
||||
/* Simply try to re-add seat0. If it is there already (i.e. CanGraphical
|
||||
* turned TRUE, then we'll find it and it will not be created again).
|
||||
*/
|
||||
factory->seat0_graphics_check_timed_out = TRUE;
|
||||
ensure_display_for_seat (factory, "seat0");
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_display_for_seat (GdmLocalDisplayFactory *factory,
|
||||
const char *seat_id)
|
||||
{
|
||||
int ret;
|
||||
gboolean seat_supports_graphics;
|
||||
gboolean is_seat0;
|
||||
- const char *session_type = "wayland";
|
||||
+ g_auto (GStrv) session_types = NULL;
|
||||
+ const char *legacy_session_types[] = { "x11", NULL };
|
||||
GdmDisplayStore *store;
|
||||
GdmDisplay *display = NULL;
|
||||
g_autofree char *login_session_id = NULL;
|
||||
gboolean wayland_enabled = FALSE, xorg_enabled = FALSE;
|
||||
g_autofree gchar *preferred_display_server = NULL;
|
||||
- gboolean falling_back;
|
||||
+ gboolean falling_back = FALSE;
|
||||
|
||||
gdm_settings_direct_get_boolean (GDM_KEY_WAYLAND_ENABLE, &wayland_enabled);
|
||||
gdm_settings_direct_get_boolean (GDM_KEY_XORG_ENABLE, &xorg_enabled);
|
||||
|
||||
preferred_display_server = get_preferred_display_server (factory);
|
||||
|
||||
if (g_strcmp0 (preferred_display_server, "none") == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: Preferred display server is none, so not creating display");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = sd_seat_can_graphical (seat_id);
|
||||
|
||||
if (ret < 0) {
|
||||
g_critical ("Failed to query CanGraphical information for seat %s", seat_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: System doesn't currently support graphics");
|
||||
seat_supports_graphics = FALSE;
|
||||
} else {
|
||||
g_debug ("GdmLocalDisplayFactory: System supports graphics");
|
||||
seat_supports_graphics = TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (seat_id, "seat0") == 0) {
|
||||
is_seat0 = TRUE;
|
||||
|
||||
falling_back = factory->num_failures > 0;
|
||||
- session_type = gdm_local_display_factory_get_session_type (factory, falling_back);
|
||||
+ session_types = gdm_local_display_factory_get_session_types (factory, falling_back);
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
|
||||
- session_type, falling_back? " fallback" : "");
|
||||
+ session_types[0], falling_back? " fallback" : "");
|
||||
} else {
|
||||
is_seat0 = FALSE;
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: New displays on seat %s will use X11 fallback", seat_id);
|
||||
/* Force legacy X11 for all auxiliary seats */
|
||||
seat_supports_graphics = TRUE;
|
||||
- session_type = "x11";
|
||||
+ session_types = g_strdupv ((char **) legacy_session_types);
|
||||
}
|
||||
|
||||
/* For seat0, we have a fallback logic to still try starting it after
|
||||
* SEAT0_GRAPHICS_CHECK_TIMEOUT seconds. i.e. we simply continue even if
|
||||
* CanGraphical is unset.
|
||||
* This is ugly, but it means we'll come up eventually in some
|
||||
* scenarios where no master device is present.
|
||||
* Note that we'll force an X11 fallback even though there might be
|
||||
* cases where an wayland capable device is present and simply not marked as
|
||||
* master-of-seat. In these cases, this should likely be fixed in the
|
||||
* udev rules.
|
||||
*
|
||||
* At the moment, systemd always sets CanGraphical for non-seat0 seats.
|
||||
* This is because non-seat0 seats are defined by having master-of-seat
|
||||
* set. This means we can avoid the fallback check for non-seat0 seats,
|
||||
* which simplifies the code.
|
||||
*/
|
||||
if (is_seat0) {
|
||||
if (!seat_supports_graphics) {
|
||||
if (!factory->seat0_graphics_check_timed_out) {
|
||||
if (factory->seat0_graphics_check_timeout_id == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: seat0 doesn't yet support graphics. Waiting %d seconds to try again.", SEAT0_GRAPHICS_CHECK_TIMEOUT);
|
||||
factory->seat0_graphics_check_timeout_id = g_timeout_add_seconds (SEAT0_GRAPHICS_CHECK_TIMEOUT,
|
||||
on_seat0_graphics_check_timeout,
|
||||
factory);
|
||||
|
||||
} else {
|
||||
/* It is not yet time to force X11 fallback. */
|
||||
g_debug ("GdmLocalDisplayFactory: seat0 display requested when there is no graphics support before graphics check timeout.");
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: Assuming we can use seat0 for X11 even though system says it doesn't support graphics!");
|
||||
g_debug ("GdmLocalDisplayFactory: This might indicate an issue where the framebuffer device is not tagged as master-of-seat in udev.");
|
||||
seat_supports_graphics = TRUE;
|
||||
- session_type = "x11";
|
||||
wayland_enabled = FALSE;
|
||||
+ g_strfreev (session_types);
|
||||
+ session_types = g_strdupv ((char **) legacy_session_types);
|
||||
} else {
|
||||
g_clear_handle_id (&factory->seat0_graphics_check_timeout_id, g_source_remove);
|
||||
}
|
||||
}
|
||||
|
||||
if (!seat_supports_graphics)
|
||||
return;
|
||||
|
||||
- if (session_type != NULL)
|
||||
+ if (session_types != NULL)
|
||||
g_debug ("GdmLocalDisplayFactory: %s login display for seat %s requested",
|
||||
- session_type, seat_id);
|
||||
+ session_types[0], seat_id);
|
||||
else if (g_strcmp0 (preferred_display_server, "legacy-xorg") == 0)
|
||||
g_debug ("GdmLocalDisplayFactory: Legacy Xorg login display for seat %s requested",
|
||||
seat_id);
|
||||
|
||||
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
|
||||
|
||||
if (is_seat0)
|
||||
display = gdm_display_store_find (store, lookup_prepared_display_by_seat_id, (gpointer) seat_id);
|
||||
else
|
||||
display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
|
||||
|
||||
/* Ensure we don't create the same display more than once */
|
||||
if (display != NULL) {
|
||||
g_debug ("GdmLocalDisplayFactory: display already created");
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we already have a login window, switch to it */
|
||||
if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
|
||||
GdmDisplay *display;
|
||||
|
||||
display = gdm_display_store_find (store,
|
||||
lookup_by_session_id,
|
||||
(gpointer) login_session_id);
|
||||
if (display != NULL &&
|
||||
(gdm_display_get_status (display) == GDM_DISPLAY_MANAGED ||
|
||||
gdm_display_get_status (display) == GDM_DISPLAY_WAITING_TO_FINISH)) {
|
||||
g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL);
|
||||
g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
|
||||
login_session_id);
|
||||
gdm_activate_session_by_id (factory->connection, seat_id, login_session_id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
|
||||
|
||||
#ifdef ENABLE_USER_DISPLAY_SERVER
|
||||
if (g_strcmp0 (preferred_display_server, "wayland") == 0 ||
|
||||
g_strcmp0 (preferred_display_server, "xorg") == 0) {
|
||||
if (is_seat0) {
|
||||
- g_autoptr (GPtrArray) supported_session_types = NULL;
|
||||
-
|
||||
- if (session_type == NULL) {
|
||||
- g_warning ("GdmLocalDisplayFactory: Both Wayland and Xorg sessions are unavailable");
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- supported_session_types = g_ptr_array_new ();
|
||||
-
|
||||
- if (g_strcmp0 (preferred_display_server, "wayland") == 0) {
|
||||
- if (wayland_enabled)
|
||||
- g_ptr_array_add (supported_session_types, "wayland");
|
||||
- } else {
|
||||
- if (xorg_enabled)
|
||||
- g_ptr_array_add (supported_session_types, "x11");
|
||||
- }
|
||||
-
|
||||
- if (!falling_back) {
|
||||
- if (g_strcmp0 (preferred_display_server, "wayland") == 0) {
|
||||
- if (xorg_enabled)
|
||||
- g_ptr_array_add (supported_session_types, "x11");
|
||||
- } else {
|
||||
- if (wayland_enabled)
|
||||
- g_ptr_array_add (supported_session_types, "wayland");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- g_ptr_array_add (supported_session_types, NULL);
|
||||
-
|
||||
display = gdm_local_display_new ();
|
||||
- g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
|
||||
- g_object_set (G_OBJECT (display), "supported-session-types", supported_session_types->pdata, NULL);
|
||||
+ g_object_set (G_OBJECT (display),
|
||||
+ "session-type", session_types[0],
|
||||
+ "supported-session-types", session_types,
|
||||
+ NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (display == NULL) {
|
||||
guint32 num;
|
||||
- const char *supported_session_types[] = { "x11", NULL };
|
||||
|
||||
num = take_next_display_number (factory);
|
||||
|
||||
display = gdm_legacy_display_new (num);
|
||||
- g_object_set (G_OBJECT (display), "supported-session-types", supported_session_types, NULL);
|
||||
+ g_object_set (G_OBJECT (display),
|
||||
+ "session-type", legacy_session_types[0],
|
||||
+ "supported-session-types", legacy_session_types,
|
||||
+ NULL);
|
||||
}
|
||||
|
||||
g_object_set (display, "seat-id", seat_id, NULL);
|
||||
g_object_set (display, "is-initial", is_seat0, NULL);
|
||||
|
||||
store_display (factory, display);
|
||||
|
||||
/* let store own the ref */
|
||||
g_object_unref (display);
|
||||
|
||||
if (! gdm_display_manage (display)) {
|
||||
gdm_display_unmanage (display);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
delete_display (GdmLocalDisplayFactory *factory,
|
||||
const char *seat_id) {
|
||||
|
||||
GdmDisplayStore *store;
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: Removing used_display_numbers on seat %s", seat_id);
|
||||
|
||||
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
|
||||
gdm_display_store_foreach_remove (store, lookup_by_seat_id, (gpointer) seat_id);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
--
|
||||
2.34.1
|
||||
|
@ -0,0 +1,96 @@
|
||||
From 0e467e3fb32d9e2a7499069699527638eb2c2be1 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Thu, 7 Oct 2021 15:34:27 -0400
|
||||
Subject: [PATCH 5/5] local-display-factory: Don't crash if Xorg and Wayland
|
||||
are both unavailable
|
||||
|
||||
At the moment if Wayland doesn't work, the login screen will fall back
|
||||
to Xorg, and if Xorg doesn't work the login screen will fall back to
|
||||
Wayland.
|
||||
|
||||
But if the fall back choice is disabled explicitly, GDM will just crash.
|
||||
|
||||
This commit fixes the crash.
|
||||
|
||||
Closes: https://gitlab.gnome.org/GNOME/gdm/-/issues/739
|
||||
---
|
||||
daemon/gdm-local-display-factory.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
|
||||
index eba38671..120847f9 100644
|
||||
--- a/daemon/gdm-local-display-factory.c
|
||||
+++ b/daemon/gdm-local-display-factory.c
|
||||
@@ -651,62 +651,67 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory,
|
||||
gdm_settings_direct_get_boolean (GDM_KEY_XORG_ENABLE, &xorg_enabled);
|
||||
|
||||
preferred_display_server = get_preferred_display_server (factory);
|
||||
|
||||
if (g_strcmp0 (preferred_display_server, "none") == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: Preferred display server is none, so not creating display");
|
||||
return;
|
||||
}
|
||||
|
||||
ret = sd_seat_can_graphical (seat_id);
|
||||
|
||||
if (ret < 0) {
|
||||
g_critical ("Failed to query CanGraphical information for seat %s", seat_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: System doesn't currently support graphics");
|
||||
seat_supports_graphics = FALSE;
|
||||
} else {
|
||||
g_debug ("GdmLocalDisplayFactory: System supports graphics");
|
||||
seat_supports_graphics = TRUE;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (seat_id, "seat0") == 0) {
|
||||
is_seat0 = TRUE;
|
||||
|
||||
falling_back = factory->num_failures > 0;
|
||||
session_types = gdm_local_display_factory_get_session_types (factory, falling_back);
|
||||
|
||||
- g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
|
||||
- session_types[0], falling_back? " fallback" : "");
|
||||
+ if (session_types == NULL) {
|
||||
+ g_debug ("GdmLocalDisplayFactory: Both Wayland and Xorg are unavailable");
|
||||
+ seat_supports_graphics = FALSE;
|
||||
+ } else {
|
||||
+ g_debug ("GdmLocalDisplayFactory: New displays on seat0 will use %s%s",
|
||||
+ session_types[0], falling_back? " fallback" : "");
|
||||
+ }
|
||||
} else {
|
||||
is_seat0 = FALSE;
|
||||
|
||||
g_debug ("GdmLocalDisplayFactory: New displays on seat %s will use X11 fallback", seat_id);
|
||||
/* Force legacy X11 for all auxiliary seats */
|
||||
seat_supports_graphics = TRUE;
|
||||
session_types = g_strdupv ((char **) legacy_session_types);
|
||||
}
|
||||
|
||||
/* For seat0, we have a fallback logic to still try starting it after
|
||||
* SEAT0_GRAPHICS_CHECK_TIMEOUT seconds. i.e. we simply continue even if
|
||||
* CanGraphical is unset.
|
||||
* This is ugly, but it means we'll come up eventually in some
|
||||
* scenarios where no master device is present.
|
||||
* Note that we'll force an X11 fallback even though there might be
|
||||
* cases where an wayland capable device is present and simply not marked as
|
||||
* master-of-seat. In these cases, this should likely be fixed in the
|
||||
* udev rules.
|
||||
*
|
||||
* At the moment, systemd always sets CanGraphical for non-seat0 seats.
|
||||
* This is because non-seat0 seats are defined by having master-of-seat
|
||||
* set. This means we can avoid the fallback check for non-seat0 seats,
|
||||
* which simplifies the code.
|
||||
*/
|
||||
if (is_seat0) {
|
||||
if (!seat_supports_graphics) {
|
||||
if (!factory->seat0_graphics_check_timed_out) {
|
||||
if (factory->seat0_graphics_check_timeout_id == 0) {
|
||||
g_debug ("GdmLocalDisplayFactory: seat0 doesn't yet support graphics. Waiting %d seconds to try again.", SEAT0_GRAPHICS_CHECK_TIMEOUT);
|
||||
factory->seat0_graphics_check_timeout_id = g_timeout_add_seconds (SEAT0_GRAPHICS_CHECK_TIMEOUT,
|
||||
--
|
||||
2.34.1
|
||||
|
13
gdm.spec
13
gdm.spec
@ -11,7 +11,7 @@
|
||||
Name: gdm
|
||||
Epoch: 1
|
||||
Version: 40.1
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
Summary: The GNOME Display Manager
|
||||
|
||||
License: GPLv2+
|
||||
@ -28,11 +28,16 @@ Patch10001: 0001-local-display-factory-Provide-more-flexibility-for-c.patch
|
||||
Patch20001: 0001-xdmcp-display-factory-Set-supported-session-types-fo.patch
|
||||
Patch20002: 0002-daemon-Don-t-update-session-type-if-no-saved-session.patch
|
||||
Patch20003: 0003-daemon-Infer-session-type-from-desktop-file-if-user-.patch
|
||||
Patch20004: 0004-daemon-Consolidate-session-type-and-supported-sessio.patch
|
||||
Patch20005: 0005-local-display-factory-Don-t-crash-if-Xorg-and-Waylan.patch
|
||||
|
||||
Patch30001: 0001-local-display-factory-Don-t-try-to-respawn-displays-.patch
|
||||
|
||||
Patch40001: 0001-session-worker-Set-session_vt-0-out-of-pam-uninitial.patch
|
||||
|
||||
Patch50001: 0001-meson-Fix-detection-of-Xorg-versions-that-need-liste.patch
|
||||
Patch50002: 0002-daemon-Support-X-servers-built-with-Dlisten_tcp-true.patch
|
||||
|
||||
# Questionable feature to support logging in over multiple XDMCP consoles at the same time
|
||||
Patch60001: 0001-manager-allow-multiple-xdmcp-logins-for-the-same-use.patch
|
||||
Patch60002: 0002-gdm-x-session-run-session-bus-on-non-seat0-seats.patch
|
||||
@ -333,6 +338,12 @@ dconf update || :
|
||||
%{_libdir}/pkgconfig/gdm-pam-extensions.pc
|
||||
|
||||
%changelog
|
||||
* Tue Feb 22 2022 Ray Strode <rstrode@redhat.com> - 40.1-12
|
||||
- More fixes from RHEL 8:
|
||||
- Fix DisallowTCP=false
|
||||
- Fix crash when both wayland and xorg are unavailable
|
||||
Related: #2056931
|
||||
|
||||
* Wed Oct 27 2021 Ray Strode <rstrode@redhat.com> - 40.1-11
|
||||
- Pull in RHEL 8 patches and drop unused patches
|
||||
Related: #2017859
|
||||
|
Loading…
Reference in New Issue
Block a user