anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0456-dbus-execute-make-transfer-of-CPUAffinity-endian-saf.patch

8be66a
From 1730f7bb306e13689a7684fd93ae5b8383a28d2f Mon Sep 17 00:00:00 2001
8be66a
From: Michal Sekletar <msekletar@users.noreply.github.com>
8be66a
Date: Fri, 31 May 2019 15:23:23 +0200
8be66a
Subject: [PATCH] dbus-execute: make transfer of CPUAffinity endian safe
8be66a
 (#12711)
8be66a
8be66a
We store the affinity mask in the native endian. However, over D-Bus we
8be66a
must transfer the mask in little endian byte order.
8be66a
8be66a
This is the second part of c367f996f5f091a63f812f0140b304c649be77fc.
8be66a
8be66a
(cherry picked from commit 75e40119a471454516ad0acc96f6f4094e7fb652)
8be66a
8be66a
Related: #1740657
8be66a
---
8be66a
 src/core/dbus-execute.c | 5 ++++-
8be66a
 1 file changed, 4 insertions(+), 1 deletion(-)
8be66a
8be66a
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
8be66a
index f9527e56b2..d5acca384f 100644
8be66a
--- a/src/core/dbus-execute.c
8be66a
+++ b/src/core/dbus-execute.c
8be66a
@@ -215,12 +215,15 @@ static int property_get_cpu_affinity(
8be66a
                 sd_bus_error *error) {
8be66a
 
8be66a
         ExecContext *c = userdata;
8be66a
+        _cleanup_free_ uint8_t *array = NULL;
8be66a
+        size_t allocated;
8be66a
 
8be66a
         assert(bus);
8be66a
         assert(reply);
8be66a
         assert(c);
8be66a
 
8be66a
-        return sd_bus_message_append_array(reply, 'y', c->cpu_set.set, c->cpu_set.allocated);
8be66a
+        (void) cpu_set_to_dbus(&c->cpu_set, &array, &allocated);
8be66a
+        return sd_bus_message_append_array(reply, 'y', array, allocated);
8be66a
 }
8be66a
 
8be66a
 static int property_get_numa_mask(