[systemd-commits] 2 commits - TODO src/libsystemd

Lennart Poettering lennart at kemper.freedesktop.org
Wed Nov 26 06:02:13 PST 2014


 TODO                                |   17 ++++++++---------
 src/libsystemd/sd-bus/bus-control.c |   22 +++++++++++++---------
 src/libsystemd/sd-bus/bus-creds.c   |    3 +--
 src/libsystemd/sd-bus/bus-kernel.c  |   17 +++--------------
 4 files changed, 25 insertions(+), 34 deletions(-)

New commits:
commit 7212c6083a5577eabc96c35c9db4c19c113cae93
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Nov 26 15:01:50 2014 +0100

    update TODO

diff --git a/TODO b/TODO
index 31809be..22c17b4 100644
--- a/TODO
+++ b/TODO
@@ -257,12 +257,18 @@ Features:
   ReadOnlyDirectories=... for whitelisting files for a service.
 
 * sd-bus:
+  - systemd-bus-proxyd needs to enforce good old XML policy
+  - kdbus: peeking is subject to a race when we look at a message while the message is being migrated to the implementor's connection. Needs kernel fix, and then we need to invoke the FREE ioctl in busname_peek_message()
   - kdbus: maybe add controlling tty and ppid metadata fields
+  - kdbus: for some reason "busctl monitor" only shows metadata for signal msgs, never method call or method reply msgs
+  - kdbus: busnames.target should get pulled in by basic.target
+  - Ignore .busname units on classic D-Bus boots, systemd-resolved cannot be started on kdbus
+    without the active policy and should get a Wants=org.freedesktop.resolve1.busname to
+    pull-in the policy.
+  - port to sd-resolve for connecting to TCP dbus servers
   - see if we can introduce a new sd_bus_get_owner_machine_id() call to retrieve the machine ID of the machine of the bus itself
   - when kdbus does not take our message without memfds, try again with memfds
-  - systemd-bus-proxyd needs to enforce good old XML policy
   - introduce sd_bus_emit_object_added()/sd_bus_emit_object_removed() that automatically includes the build-in interfaces in the list
-  - port to sd-resolve for connecting to TCP dbus servers
   - see if we can drop more message validation on the sending side
   - add API to clone sd_bus_message objects
   - make AddMatch calls on dbus1 transports async?
@@ -275,17 +281,10 @@ Features:
        - path escaping
   - update systemd.special(7) to mention that dbus.socket is only about the compatibility socket now
   - test bloom filter generation indexes
-  - kdbus: peeking is subject to a race when we look at a message while the message is being migrated to the implementor's connection. Needs kernel fix, and then we need to invoke the FREE ioctl in busname_peek_message()
-  - kdbus: for some reason "busctl monitor" only shows metadata for signal msgs, never method call or method reply msgs
-  - kdbus: busnames.target should get pulled in by basic.target
-  - Ignore .busname units on classic D-Bus boots, systemd-resolved cannot be started on kdbus
-    without the active policy and should get a Wants=org.freedesktop.resolve1.busname to
-    pull-in the policy.
   - bus-proxy: when passing messages from kdbus, make sure we properly
     handle the case where a large number of fds is appended that we
     cannot pass into sendmsg() of the AF_UNIX sokcet (which only accepts
     253 messages)
-  - kdbus: auxgroups is now uin32_t, we don't have to convert the array anymore while exposing it in the creds structure
   - kdbus: introduce a concept of "send-only" connections
 
 * sd-event

commit e12d81ae80214ef05ddedafd016bdd604ce17d12
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Nov 26 14:59:12 2014 +0100

    sd-bus: given that the kernel now passes the auxgroups list as 32bit array to us, no need to convert to uid_t manually
    
    This way, we can save one allocation and avoid copying the array
    unnecesarily.

diff --git a/src/libsystemd/sd-bus/bus-control.c b/src/libsystemd/sd-bus/bus-control.c
index 9cd5cd5..758715d 100644
--- a/src/libsystemd/sd-bus/bus-control.c
+++ b/src/libsystemd/sd-bus/bus-control.c
@@ -402,6 +402,10 @@ static int bus_populate_creds_from_items(
         uint64_t m;
         int r;
 
+        assert(bus);
+        assert(info);
+        assert(c);
+
         KDBUS_ITEM_FOREACH(item, info, items) {
 
                 switch (item->type) {
@@ -590,18 +594,18 @@ static int bus_populate_creds_from_items(
 
                 case KDBUS_ITEM_AUXGROUPS:
                         if (mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) {
-                                size_t i, n;
-                                uid_t *u;
+                                size_t n;
+                                uid_t *g;
 
-                                n = (item->size - offsetof(struct kdbus_item, data64)) / sizeof(uint64_t);
-                                u = new(uid_t, n);
-                                if (!u)
-                                        return -ENOMEM;
+                                assert_cc(sizeof(gid_t) == sizeof(uint32_t));
 
-                                for (i = 0; i < n; i++)
-                                        u[i] = (uid_t) item->data64[i];
+                                n = (item->size - offsetof(struct kdbus_item, data32)) / sizeof(uint32_t);
+                                g = newdup(gid_t, item->data32, n);
+                                if (!g)
+                                        return -ENOMEM;
 
-                                c->supplementary_gids = u;
+                                free(c->supplementary_gids);
+                                c->supplementary_gids = g;
                                 c->n_supplementary_gids = n;
 
                                 c->mask |= SD_BUS_CREDS_SUPPLEMENTARY_GIDS;
diff --git a/src/libsystemd/sd-bus/bus-creds.c b/src/libsystemd/sd-bus/bus-creds.c
index 43315b5..8aa5336 100644
--- a/src/libsystemd/sd-bus/bus-creds.c
+++ b/src/libsystemd/sd-bus/bus-creds.c
@@ -53,8 +53,6 @@ void bus_creds_done(sd_bus_creds *c) {
 
         strv_free(c->cmdline_array);
         strv_free(c->well_known_names);
-
-        free(c->supplementary_gids);
 }
 
 _public_ sd_bus_creds *sd_bus_creds_ref(sd_bus_creds *c) {
@@ -97,6 +95,7 @@ _public_ sd_bus_creds *sd_bus_creds_unref(sd_bus_creds *c) {
                         free(c->unique_name);
                         free(c->cgroup_root);
                         free(c->description);
+                        free(c->supplementary_gids);
                         free(c);
                 }
         } else {
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 907c5c5..2beaa89 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -677,21 +677,10 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k) {
                 case KDBUS_ITEM_AUXGROUPS:
 
                         if (bus->creds_mask & SD_BUS_CREDS_SUPPLEMENTARY_GIDS) {
-                                size_t i, n;
-                                uid_t *u;
-                                n = (d->size - offsetof(struct kdbus_item, data32)) / sizeof(uint32_t);
-                                u = new(uid_t, n);
-                                if (!u) {
-                                        r = -ENOMEM;
-                                        goto fail;
-                                }
-
-                                for (i = 0; i < n; i++)
-                                        u[i] = (uid_t) d->data32[i];
-
-                                m->creds.supplementary_gids = u;
-                                m->creds.n_supplementary_gids = n;
+                                assert_cc(sizeof(gid_t) == sizeof(uint32_t));
 
+                                m->creds.n_supplementary_gids = (d->size - offsetof(struct kdbus_item, data32)) / sizeof(uint32_t);
+                                m->creds.supplementary_gids = (gid_t*) d->data32;
                                 m->creds.mask |= SD_BUS_CREDS_SUPPLEMENTARY_GIDS;
                         }
 



More information about the systemd-commits mailing list