[arch-commits] Commit in systemd/trunk (2 files)

Dave Reisner dreisner at nymeria.archlinux.org
Wed Sep 18 17:18:41 UTC 2013


    Date: Wednesday, September 18, 2013 @ 19:18:41
  Author: dreisner
Revision: 194572

upgpkg: systemd 207-3

- backport fix for CVE-2013-4327

Added:
  systemd/trunk/0001-polkit-Avoid-race-condition-in-scraping-proc.patch
Modified:
  systemd/trunk/PKGBUILD

---------------------------------------------------------+
 0001-polkit-Avoid-race-condition-in-scraping-proc.patch |   75 ++++++++++++++
 PKGBUILD                                                |    5 
 2 files changed, 79 insertions(+), 1 deletion(-)

Added: 0001-polkit-Avoid-race-condition-in-scraping-proc.patch
===================================================================
--- 0001-polkit-Avoid-race-condition-in-scraping-proc.patch	                        (rev 0)
+++ 0001-polkit-Avoid-race-condition-in-scraping-proc.patch	2013-09-18 17:18:41 UTC (rev 194572)
@@ -0,0 +1,75 @@
+From 72fd713962ca2c2450e23b01d9e22017a7e28fd4 Mon Sep 17 00:00:00 2001
+From: Colin Walters <walters at verbum.org>
+Date: Thu, 22 Aug 2013 13:55:21 -0400
+Subject: [PATCH] polkit: Avoid race condition in scraping /proc
+
+If a calling process execve()s a setuid program, it can appear to be
+uid 0.  Since we're receiving requests over DBus, avoid this by simply
+passing system-bus-name as a subject.
+---
+ src/shared/polkit.c | 31 +++++--------------------------
+ 1 file changed, 5 insertions(+), 26 deletions(-)
+
+diff --git a/src/shared/polkit.c b/src/shared/polkit.c
+index cea7074..1c5e9e3 100644
+--- a/src/shared/polkit.c
++++ b/src/shared/polkit.c
+@@ -38,12 +38,8 @@ int verify_polkit(
+ 
+ #ifdef ENABLE_POLKIT
+         DBusMessage *m = NULL, *reply = NULL;
+-        const char *unix_process = "unix-process", *pid = "pid", *starttime = "start-time", *cancel_id = "";
++        const char *system_bus_name = "system-bus-name", *name = "name", *cancel_id = "";
+         uint32_t flags = interactive ? 1 : 0;
+-        pid_t pid_raw;
+-        uint32_t pid_u32;
+-        unsigned long long starttime_raw;
+-        uint64_t starttime_u64;
+         DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant;
+         int r;
+         dbus_bool_t authorized = FALSE, challenge = FALSE;
+@@ -68,14 +64,6 @@ int verify_polkit(
+ 
+ #ifdef ENABLE_POLKIT
+ 
+-        pid_raw = bus_get_unix_process_id(c, sender, error);
+-        if (pid_raw == 0)
+-                return -EINVAL;
+-
+-        r = get_starttime_of_pid(pid_raw, &starttime_raw);
+-        if (r < 0)
+-                return r;
+-
+         m = dbus_message_new_method_call(
+                         "org.freedesktop.PolicyKit1",
+                         "/org/freedesktop/PolicyKit1/Authority",
+@@ -86,22 +74,13 @@ int verify_polkit(
+ 
+         dbus_message_iter_init_append(m, &iter_msg);
+ 
+-        pid_u32 = (uint32_t) pid_raw;
+-        starttime_u64 = (uint64_t) starttime_raw;
+-
+         if (!dbus_message_iter_open_container(&iter_msg, DBUS_TYPE_STRUCT, NULL, &iter_struct) ||
+-            !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &unix_process) ||
++            !dbus_message_iter_append_basic(&iter_struct, DBUS_TYPE_STRING, &system_bus_name) ||
+             !dbus_message_iter_open_container(&iter_struct, DBUS_TYPE_ARRAY, "{sv}", &iter_array) ||
+             !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
+-            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &pid) ||
+-            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "u", &iter_variant) ||
+-            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT32, &pid_u32) ||
+-            !dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
+-            !dbus_message_iter_close_container(&iter_array, &iter_dict) ||
+-            !dbus_message_iter_open_container(&iter_array, DBUS_TYPE_DICT_ENTRY, NULL, &iter_dict) ||
+-            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &starttime) ||
+-            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "t", &iter_variant) ||
+-            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_UINT64, &starttime_u64) ||
++            !dbus_message_iter_append_basic(&iter_dict, DBUS_TYPE_STRING, &name) ||
++            !dbus_message_iter_open_container(&iter_dict, DBUS_TYPE_VARIANT, "s", &iter_variant) ||
++            !dbus_message_iter_append_basic(&iter_variant, DBUS_TYPE_STRING, &sender) ||
+             !dbus_message_iter_close_container(&iter_dict, &iter_variant) ||
+             !dbus_message_iter_close_container(&iter_array, &iter_dict) ||
+             !dbus_message_iter_close_container(&iter_struct, &iter_array) ||
+-- 
+1.8.4
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2013-09-18 17:14:05 UTC (rev 194571)
+++ PKGBUILD	2013-09-18 17:18:41 UTC (rev 194572)
@@ -4,7 +4,7 @@
 pkgbase=systemd
 pkgname=('systemd' 'systemd-sysvcompat')
 pkgver=207
-pkgrel=2
+pkgrel=3
 arch=('i686' 'x86_64')
 url="http://www.freedesktop.org/wiki/Software/systemd"
 makedepends=('acl' 'cryptsetup' 'dbus-core' 'docbook-xsl' 'gobject-introspection' 'gperf'
@@ -15,6 +15,7 @@
         'initcpio-hook-udev'
         'initcpio-install-systemd'
         'initcpio-install-udev'
+        0001-polkit-Avoid-race-condition-in-scraping-proc.patch
         0001-swap-fix-reverse-dependencies.patch
         0002-swap-create-.wants-symlink-to-auto-swap-devices.patch)
 md5sums=('7799f3cc9d289b8db1c1fa56ae7ecd88'
@@ -21,6 +22,7 @@
          '2de72238ed5c0df62a7c3b6bdaf8cb7c'
          '9027b31a875e74a45623954b3b23d09f'
          'd83d45e67cd75cdbafb81c96a7485319'
+         '9eb0a46aa2a3a6d74117f9a174dbe168'
          '182be4c729aaecde249b7b05b48a481f'
          'b54fbe35e2689ac36cda9ac4a5a86f24')
 
@@ -29,6 +31,7 @@
 
   patch -Np1 <"$srcdir"/0001-swap-fix-reverse-dependencies.patch
   patch -Np1 <"$srcdir"/0002-swap-create-.wants-symlink-to-auto-swap-devices.patch
+  patch -Np1 <"$srcdir"/0001-polkit-Avoid-race-condition-in-scraping-proc.patch
 }
 
 build() {




More information about the arch-commits mailing list