[systemd-commits] src/libsystemd-bus

Kay Sievers kay at kemper.freedesktop.org
Sun May 12 11:19:15 PDT 2013


 src/libsystemd-bus/bus-kernel.c |   16 +++++++++-------
 src/libsystemd-bus/kdbus.h      |    8 +++-----
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 18cd014f13cb988037acc16f8150b8f6d7042cd5
Author: Kay Sievers <kay at vrfy.org>
Date:   Sun May 12 20:11:03 2013 +0200

    bus: remove KDBUS_MAKE_ACCESS_WORLD, remove (n_payload > 2) check
    
    KDBUS_MAKE_ACCESS_WORLD is no longer needed, the kernel creates the
    kdbus device node with the uid/gid of the caller now.

diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 3fb5822..e329b14 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -72,7 +72,7 @@ static void append_payload_vec(struct kdbus_item **d, const void *p, size_t sz)
 
         (*d)->size = offsetof(struct kdbus_item, vec) + sizeof(struct kdbus_vec);
         (*d)->type = KDBUS_MSG_PAYLOAD_VEC;
-        (*d)->vec.address = (intptr_t) p;
+        (*d)->vec.address = (uint64_t) p;
         (*d)->vec.size = sz;
 
         *d = (struct kdbus_item *) ((uint8_t*) *d + (*d)->size);
@@ -436,7 +436,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
                                 if (d->vec.size < sizeof(struct bus_header))
                                         return -EBADMSG;
 
-                                h = (struct bus_header*) d->vec.address;
+                                h = (struct bus_header*)(uintptr_t) d->vec.address;
                         }
 
                         n_payload++;
@@ -471,8 +471,8 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
         if (n_bytes != total)
                 return -EBADMSG;
 
-        if (n_payload > 2)
-                return -EBADMSG;
+        //if (n_payload > 2)
+        //        return -EBADMSG;
 
         r = bus_message_from_header(h, sizeof(struct bus_header), fds, n_fds, NULL, seclabel, 0, &m);
         if (r < 0)
@@ -485,8 +485,10 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess
 
                 if (d->type == KDBUS_MSG_PAYLOAD_VEC) {
 
-                        range_contains(idx, d->vec.size, ALIGN8(sizeof(struct bus_header)), BUS_MESSAGE_FIELDS_SIZE(m), (void*) d->vec.address, &m->fields);
-                        range_contains(idx, d->vec.size, ALIGN8(sizeof(struct bus_header)) + ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m)), BUS_MESSAGE_BODY_SIZE(m), (void*) d->vec.address, &m->body);
+                        range_contains(idx, d->vec.size, ALIGN8(sizeof(struct bus_header)), BUS_MESSAGE_FIELDS_SIZE(m),
+                                       (void *)(uintptr_t) d->vec.address, &m->fields);
+                        range_contains(idx, d->vec.size, ALIGN8(sizeof(struct bus_header)) + ALIGN8(BUS_MESSAGE_FIELDS_SIZE(m)),
+                                       BUS_MESSAGE_BODY_SIZE(m), (void *)(uintptr_t) d->vec.address, &m->body);
 
                         idx += d->vec.size;
 
@@ -624,7 +626,7 @@ int bus_kernel_create(const char *name, char **s) {
         n->size = KDBUS_ITEM_HEADER_SIZE + strlen(n->str) + 1;
 
         make->size = offsetof(struct kdbus_cmd_bus_make, items) + cg->size + n->size;
-        make->flags = KDBUS_MAKE_ACCESS_WORLD | KDBUS_MAKE_POLICY_OPEN;
+        make->flags = KDBUS_MAKE_POLICY_OPEN;
         make->bus_flags = 0;
         make->bloom_size = BLOOM_SIZE;
         assert_cc(BLOOM_SIZE % 8 == 0);
diff --git a/src/libsystemd-bus/kdbus.h b/src/libsystemd-bus/kdbus.h
index 1f855b0..9dd28a7 100644
--- a/src/libsystemd-bus/kdbus.h
+++ b/src/libsystemd-bus/kdbus.h
@@ -214,7 +214,7 @@ struct kdbus_policy {
 
 struct kdbus_cmd_policy {
 	__u64 size;
-	__u8 buffer[0];		/* a series of KDBUS_POLICY_NAME plus one or
+	__u8 data[0];		/* a series of KDBUS_POLICY_NAME plus one or
 				 * more KDBUS_POLICY_ACCESS each. */
 };
 
@@ -237,7 +237,7 @@ enum {
 /* Items to append to struct kdbus_cmd_hello */
 enum {
 	KDBUS_HELLO_NULL,
-	KDBUS_HELLO_POOL,	/* kdbus_vec, userspace supplied buffer to
+	KDBUS_HELLO_POOL,	/* kdbus_vec, userspace supplied pool to
 				 * place received messages */
 };
 
@@ -419,10 +419,8 @@ enum kdbus_cmd {
 	/* kdbus ep node commands: require ep owner state */
 	KDBUS_CMD_EP_POLICY_SET =	_IOWR(KDBUS_IOC_MAGIC, 0x70, struct kdbus_cmd_policy),
 
-	/* kdbus ep node commands: */
-	KDBUS_CMD_MEMFD_NEW =		_IOWR(KDBUS_IOC_MAGIC, 0x80, int *),
-
 	/* kdbus memfd commands: */
+	KDBUS_CMD_MEMFD_NEW =		_IOWR(KDBUS_IOC_MAGIC, 0x80, int *),
 	KDBUS_CMD_MEMFD_SIZE_GET =	_IOWR(KDBUS_IOC_MAGIC, 0x81, __u64 *),
 	KDBUS_CMD_MEMFD_SIZE_SET =	_IOWR(KDBUS_IOC_MAGIC, 0x82, __u64 *),
 	KDBUS_CMD_MEMFD_SEAL_GET =	_IOWR(KDBUS_IOC_MAGIC, 0x83, int *),



More information about the systemd-commits mailing list