[gdm] worker: abort if we can't fix up terminal mode
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm] worker: abort if we can't fix up terminal mode
- Date: Tue, 17 Mar 2015 16:33:00 +0000 (UTC)
commit 31e0b50ae247aa76657a192726751344b2ee6443
Author: Ray Strode <rstrode redhat com>
Date: Tue Mar 17 12:30:25 2015 -0400
worker: abort if we can't fix up terminal mode
An overzealous SELinux policy can lead to required tty ioctls
failing. Various bits of GDM, the X server and wayland expect these
ioctls to succeed, so bail early if they fail.
https://bugzilla.gnome.org/show_bug.cgi?id=745675
daemon/gdm-session-worker.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index ec41351..1bcca14 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -982,11 +982,12 @@ on_acquire_display (int signal)
close(fd);
}
-static void
+static gboolean
handle_terminal_vt_switches (GdmSessionWorker *worker,
int tty_fd)
{
struct vt_mode setmode_request = { 0 };
+ gboolean succeeded = TRUE;
setmode_request.mode = VT_PROCESS;
setmode_request.relsig = RELEASE_DISPLAY_SIGNAL;
@@ -994,10 +995,13 @@ handle_terminal_vt_switches (GdmSessionWorker *worker,
if (ioctl (tty_fd, VT_SETMODE, &setmode_request) < 0) {
g_debug ("GdmSessionWorker: couldn't manage VTs manually: %m");
+ succeeded = FALSE;
}
signal (RELEASE_DISPLAY_SIGNAL, on_release_display);
signal (ACQUIRE_DISPLAY_SIGNAL, on_acquire_display);
+
+ return succeeded;
}
static void
@@ -1007,9 +1011,11 @@ fix_terminal_vt_mode (GdmSessionWorker *worker,
struct vt_mode getmode_reply = { 0 };
int kernel_display_mode = 0;
gboolean mode_fixed = FALSE;
+ gboolean succeeded = TRUE;
if (ioctl (tty_fd, VT_GETMODE, &getmode_reply) < 0) {
g_debug ("GdmSessionWorker: couldn't query VT mode: %m");
+ succeeded = FALSE;
}
if (getmode_reply.mode != VT_AUTO) {
@@ -1018,6 +1024,7 @@ fix_terminal_vt_mode (GdmSessionWorker *worker,
if (ioctl (tty_fd, KDGETMODE, &kernel_display_mode) < 0) {
g_debug ("GdmSessionWorker: couldn't query kernel display mode: %m");
+ succeeded = FALSE;
}
if (kernel_display_mode == KD_TEXT) {
@@ -1027,9 +1034,14 @@ fix_terminal_vt_mode (GdmSessionWorker *worker,
/* VT is in the anti-social state of VT_AUTO + KD_GRAPHICS,
* fix it.
*/
- handle_terminal_vt_switches (worker, tty_fd);
+ succeeded = handle_terminal_vt_switches (worker, tty_fd);
mode_fixed = TRUE;
out:
+ if (!succeeded) {
+ g_error ("GdmSessionWorker: couldn't set up terminal, aborting...");
+ return;
+ }
+
g_debug ("GdmSessionWorker: VT mode did %sneed to be fixed",
mode_fixed? "" : "not ");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]