chiark / gitweb /
bus: remove KDBUS_MAKE_ACCESS_WORLD, remove (n_payload > 2) check
authorKay Sievers <kay@vrfy.org>
Sun, 12 May 2013 18:11:03 +0000 (20:11 +0200)
committerKay Sievers <kay@vrfy.org>
Sun, 12 May 2013 18:17:47 +0000 (20:17 +0200)
KDBUS_MAKE_ACCESS_WORLD is no longer needed, the kernel creates the
kdbus device node with the uid/gid of the caller now.

src/libsystemd-bus/bus-kernel.c
src/libsystemd-bus/kdbus.h

index 3fb5822a8f4d46bab0bd69cc89b8f4f23c7431db..e329b14be819d43f16cc5287ba97cb10ab7367ac 100644 (file)
@@ -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);
index 1f855b040be6138ea69d2545b96ad30ad59a6d47..9dd28a71c2e08463381f00a67cf0e015f66f98ac 100644 (file)
@@ -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 *),