xserver: Branch 'master' - 2 commits

Keith Packard keithp at kemper.freedesktop.org
Fri Apr 17 10:58:44 PDT 2015


 hw/xfree86/os-support/linux/systemd-logind.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

New commits:
commit b1029716e41e252f149b82124a149da180607c96
Author: Ray Strode <rstrode at redhat.com>
Date:   Thu Apr 16 11:28:16 2015 -0400

    systemd-logind: don't second guess D-Bus default timeout
    
    At the moment, the X server uses a non-default timeout for D-Bus
    messages to systemd-logind. The only timeouts normally used with
    D-Bus are:
    
    1) Infinite
    2) Default
    
    Anything else is just as arbitrary as Default, and so rarely makes
    sense to use instead of Default.
    
    Put another way, there's little reason to be fault tolerant against
    a local root running daemon (logind), that in some configurations, the
    X server already depends on for proper functionality.
    
    This commit changes systemd-logind to just use the default timeouts.
    
    Downstream-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1209347
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 57c87c0..4ad41a3 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -40,8 +40,6 @@
 
 #include "systemd-logind.h"
 
-#define DBUS_TIMEOUT 500 /* Wait max 0.5 seconds */
-
 struct systemd_logind_info {
     DBusConnection *conn;
     char *session;
@@ -130,7 +128,7 @@ systemd_logind_take_fd(int _major, int _minor, const char *path,
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: failed to take device %s: %s\n",
                    path, error.message);
@@ -207,7 +205,7 @@ systemd_logind_release_fd(int _major, int _minor, int fd)
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply)
         LogMessage(X_ERROR, "systemd-logind: failed to release device: %s\n",
                    error.message);
@@ -289,7 +287,7 @@ systemd_logind_ack_pause(struct systemd_logind_info *info,
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply)
         LogMessage(X_ERROR, "systemd-logind: failed to ack pause: %s\n",
                    error.message);
@@ -457,7 +455,7 @@ connect_hook(DBusConnection *connection, void *data)
     }
 
     reply = dbus_connection_send_with_reply_and_block(connection, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: failed to get session: %s\n",
                    error.message);
@@ -492,7 +490,7 @@ connect_hook(DBusConnection *connection, void *data)
     }
 
     reply = dbus_connection_send_with_reply_and_block(connection, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: TakeControl failed: %s\n",
                    error.message);
@@ -564,7 +562,7 @@ systemd_logind_release_control(struct systemd_logind_info *info)
     }
 
     reply = dbus_connection_send_with_reply_and_block(info->conn, msg,
-                                                      DBUS_TIMEOUT, &error);
+                                                      DBUS_TIMEOUT_USE_DEFAULT, &error);
     if (!reply) {
         LogMessage(X_ERROR, "systemd-logind: ReleaseControl failed: %s\n",
                    error.message);
commit 792e9251670ce94210df5c6d354059bbb97f4478
Author: Ray Strode <rstrode at redhat.com>
Date:   Thu Apr 16 11:28:15 2015 -0400

    systemd-logind: filter out non-signal messages from message filter
    
    It's possible to receive a message reply in the message filter if a
    previous message call timed out locally before the reply arrived.
    
    The message_filter function only handles signals, at the moment, and
    does not properly handle message replies.
    
    This commit changes the message_filter function to filter out all
    non-signal messages, including spurious message replies.
    
    Downstream-bug: https://bugzilla.redhat.com/show_bug.cgi?id=1209347
    Signed-off-by: Ray Strode <rstrode at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 49758f4..57c87c0 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -313,6 +313,9 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
     dbus_int32_t major, minor;
     char *pause_str;
 
+    if (dbus_message_get_type (message) != DBUS_MESSAGE_TYPE_SIGNAL)
+        return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
     dbus_error_init(&error);
 
     if (dbus_message_is_signal(message,


More information about the xorg-commit mailing list