Commit Graph

55 Commits

Author SHA1 Message Date
David Herrmann e1141a9622 sd-bus: support matching on destination names
Right now, we never install destination matches on kdbus as the kernel did
not support MATCH rules on those. With the introduction of
KDBUS_ITEM_DST_ID we can now match on destination IDs, so add explicit
support for those.

This requires a recent kdbus module to work. However, there seems to be no
user-space that uses "Destination=''" matches, yet, so old kdbus modules
still work fine (we couldn't find any real user).

This is needed to match on unicast signals in bus-proxy. A followup will
add support for this.
2015-07-06 17:45:33 +02:00
David Herrmann a34333a1d1 bus: update kdbus.h
Sync with upstream.
2015-06-04 20:26:21 +02:00
Daniel Mack 606303a93e sd-bus: sync kdbus.h (ABI break)
After some reconsideration, we decided to move the binary protocol
back to 64-bit wide UIDs and GIDs. After all, it should be possible
to redefine [gu]id_t to uint64_t and things should continue to
work. As we want to avoid such data types in kdbus.h, let's move
back to 64-bit values and be safe.

In sd-bus, we have to do a translation between uint64_t and gid_t
now for supplementary gids.

Some inline comments have also been updated in kdbus upstream.
2015-03-02 11:36:35 +01:00
Daniel Mack 6ad4a4fc43 sd-bus: sync kdbus.h
Follow two small changes in the kdbus API:

 * Flags are now returned in cmd->return_flags by KDBUS_CMD_NAME_ACQUIRE

 * struct kdbus_item_list has been dropped. The information stored in
   this struct was redundant since awhile already, as all commands
   report their returned slice size anyway.
2015-02-24 12:10:13 +01:00
David Herrmann 00d053d3ca bus: sync with kdbus.git (ABI break)
This syncs up the new KDBUS_CMD_CONN_INFO behavior:
 - attach-flags are passed in .attach_flags, instead of directly merged
   with the command flags.
2015-02-19 20:02:40 +01:00
David Herrmann 83e30358f2 bus: sync with kdbus
Pull in new kdbus changes, namely:
 - EOVERFLOW is replaces by KDBUS_RECV_RETURN_DROPPED_MSGS
 - ENOMSG is merged with EAGAIN for consistency
2015-02-17 18:16:07 +01:00
David Herrmann b2086f601b bus: sync with kdbus (ABI break) 2015-02-05 16:52:42 +01:00
Daniel Mack a9c8343e83 sd-bus: sync kdbus.h (API break)
Just a simple variable rename, and a dropped flag that sd-bus didn't make
use of.
2015-01-12 18:15:45 +01:00
Kay Sievers d031efb271 kdbus.h: update 2015-01-10 04:16:18 +01:00
Daniel Mack d7d052b23f sd-bus: sync kdbus.h
Catch up with latest changes in kdbus.ko:

 * Signals can be sent as unicast now, hence they need to be marked as
   such with the KDBUS_MSG_SIGNAL in the message flags.

 * Follow ioctl number change for KDBUS_CMD_FREE
2015-01-05 13:44:40 +01:00
Daniel Mack 6ad9bb71c2 sd-bus: sync kdbus.h (ABI break)
Sync kdbus.h with upstream changes:

  * Two optional cancellation points where added for synchronously
    blocking KDBUS_CMD_SEND commands: A sigmask to change the mask
    of accepted signals before the task is put to sleep, and a
    generic file descriptor that can be written to, in order to cancel
    the command. Both methods are currently unused.

  * The KDBUS_CMD_CANCEL ioctl was removed. sd-bus was never using
    that command, so there's no change needed.

  * Some kerneldoc fixes
2014-12-20 19:23:49 +01:00
David Herrmann d31f486b83 bus: sync with kdbus.git
Changes:
 * bloom parameters are returned in an offset via HELLO
 * FREE now takes items just like any other ioctl
2014-12-11 17:26:03 +01:00
David Herrmann 94e15fdc4d bus: sync with kdbus.git
Sync up with recent kdbus changed:
 * several ioctls gained .size and .items members (but still unused)
 * CMD_SEND gained its own ioctl structure
 * several members of kdbus_msg were dropped as they were only used during
   SEND, not during RECV etc.
 * CMD_RECV and CMD_SEND now share a kdbus_reply member which contains the
   offset and size of the returned message.
2014-12-11 13:19:41 +01:00
Lennart Poettering 3280236156 sd-bus: get rid of PID starttime concept
As kdbus no longer exports this, remove all traces from sd-bus too
2014-12-09 18:16:54 +01:00
David Herrmann 77adde6382 bus: sync with kdbus-git (ABI break)
kdbus-git gained two new features:
 * memfd offsets: This allows to specify a 'start' offset in kdbus_memfd
                  so you can send partial memfd hunks instead of always
                  the full memfd
 * KDBUS_HELLO_UNPRIVILEGED: If passed during HELLO, the client will be
                             treated as unprivileged.
2014-12-09 11:14:55 +01:00
Lennart Poettering d108ddf172 sd-bus: update kdbus.h from upstream 2014-11-26 15:43:50 +01:00
David Herrmann affc7fe9e1 bus: update kdbus.h (ABI break)
We changed creds to u32, so fix systemd sd-bus to acknowledge that.
2014-11-26 11:11:54 +01:00
Lennart Poettering bd5f920f12 core: show log message about process triggering kdbus service activation 2014-11-25 20:52:48 +01:00
Lennart Poettering 48eaba354e kdbus: update header file to current upstream version 2014-11-25 19:25:33 +01:00
Lennart Poettering 705a415f68 sd-bus: update to current kernel version, by splitting off the extended KDBUS_ITEM_PIDS structure from KDBUS_ITEM_CREDS
Also:

- adds support for euid, suid, fsuid, egid, sgid, fsgid fields.

- makes augmentation of creds with data from /proc explicitly
  controllable to give apps better control over this, given that this is
  racy.

- enables augmentation for kdbus connections (previously we only did it
  for dbus1). This is useful since with recent kdbus versions it is
  possible for clients to control the metadata they want to send.

- changes sd_bus_query_sender_privilege() to take the euid of the client
  into consideration, if known

- when we don't have permissions to read augmentation data from /proc,
  don't fail, just don't add the data in
2014-11-25 14:28:34 +01:00
Daniel Mack 63cc4c3138 sd-bus: sync with kdbus upstream (ABI break)
kdbus has seen a larger update than expected lately, most notably with
kdbusfs, a file system to expose the kdbus control files:

 * Each time a file system of this type is mounted, a new kdbus
   domain is created.

 * The layout inside each mount point is the same as before, except
   that domains are not hierarchically nested anymore.

 * Domains are therefore also unnamed now.

 * Unmounting a kdbusfs will automatically also detroy the
   associated domain.

 * Hence, the action of creating a kdbus domain is now as
   privileged as mounting a filesystem.

 * This way, we can get around creating dev nodes for everything,
   which is last but not least something that is not limited by
   20-bit minor numbers.

The kdbus specific bits in nspawn have all been dropped now, as nspawn
can rely on the container OS to set up its own kdbus domain, simply by
mounting a new instance.

A new set of mounts has been added to mount things *after* the kernel
modules have been loaded. For now, only kdbus is in this set, which is
invoked with mount_setup_late().
2014-11-13 20:41:52 +01:00
Daniel Mack d704fda934 sd-bus: sync up with new kdbus metadata attachment logic (ABI break)
The metadata logic in kdbus has seen a rework, and the only mandatory
change we have to follow for now is that attach_flags in kdbus_cmd_hello
is now split into two parts, attach_flags_send and attach_flags_recv.
2014-11-05 14:48:20 +01:00
Daniel Mack 635f9f0d95 sd-bus: sync kdbus.h (ABI break)
Catch up with some changes in kdbus.h:

  * KDBUS_{ITEM,ATTACH}_CONN_NAME were renamed to
    KDBUS_{ITEM,ATTACH}_CONN_DESCRIPTION, so the term 'name' is not
    overloaded as much.

  * The item types were re-ordered a little so they are lined up to the
    order of the corresponding KDBUS_ATTACH flags

  * A new item type KDBUS_ITEM_OWNED_NAME was introduced, designated to
    store a struct kdbus_name in item->name. KDBUS_ITEM_NAME soley
    stores data in item->str now

  * Some kerneldoc fixes
2014-11-04 12:44:53 +01:00
Daniel Mack 5ebe2ce782 sd-bus: sync kdbus.h (ABI break)
Some comment fixes and header cleanups in kdbus.h, and the task capability
meta information has been factored out to its own struct.
2014-10-27 17:02:31 +01:00
Daniel Mack a1783d61a8 sd-bus: sync kdbus.h
kdbus learned a new command to query a bus creator's credentials. Sync
kdbus.h first, which also renames some struct to more generic terms.
That is, however, not an ABI break this time.
2014-10-22 19:45:07 +02:00
Daniel Mack 03785ad0e5 sd-bus: sync kdbus.h (API change: switch to absolute timeouts)
kdbus_msg.timeout_ns now takes an absolute value, based on CLOCK_MONOTONIC,
in order to eventually support automatically restarted syscalls.

Signed-off-by: Daniel Mack <daniel@zonque.org>
2014-10-21 22:14:03 +02:00
Daniel Mack bc75205c77 sd-bus: sync kdbus.h (ABI break)
In kdbus.h, the following details changed:

 * All commands gained a 'kernel_flags' field to report the flags supported
   by the driver. Before, this was done in the 'flags' field in a
   bidirectional way, which turned out to be a problem for the code in
   sd-bus, as many parts of it reuse the same ioctl struct more than once
   and consider them to be owned by userspace.

 * Name listings are now returned by a new struct instead of reusing struct
   kdbus_cmd_name for that matter. This way, we don't add more unneeded
   fields to it and make the API cleaner.

 * 'conn_flags' was renamed to 'flags' in struct kdbus_cmd_hello to make
   the API a bit more unified.
2014-10-21 19:19:44 +02:00
Daniel Mack a2243d5488 sd-bus: sync kdbus.h (ABI break)
kdbus.h now has KDBUS_ATTACH_COMM split into KDBUS_ATTACH_TID_COMM and
KDBUS_ATTACH_PID_COMM. The items were split already, so the change in
systemd is easy.
2014-10-20 15:26:00 +02:00
Daniel Mack 4a3e79e1b6 sd-bus: sync kdbus.h (ABI break)
In kdbus.h, the 'features' field has been dropped again. Instead of
negotiating features that way, we decided to make the kernel return the
set of supported flags in each ioctl struct's .flags field, in both the
success and error cases.
2014-10-18 20:57:53 +02:00
Kay Sievers c32195e057 Revert "sd-bus: sync kdbus.h (ABI break)"
This reverts commit 1a2409e262.

Support from the kdbus interface was removed. We require
memfds to be supported by all clients.
2014-10-17 10:12:44 +02:00
Daniel Mack 1a2409e262 sd-bus: sync kdbus.h (ABI break)
kdbus learned KDBUS_HELLO_ACCEPT_MEMFD as new connection negotiation
flag. Set it by default in systemd for now.
2014-10-14 20:03:06 +02:00
Daniel Mack 40885bb29e sd-bus: sync kdbus.h (ABI break)
Sync kdbus.h once again. Two thing have changed:

 a) KDBUS_CMD_EP_* was renamed to KDBUS_CMD_ENDPOINT_*
 b) struct kdbus_cmd_hello and struct kdbus_cmd_make gained a
    'features' bitfield (which is currently unused)
2014-10-08 17:30:49 +02:00
Daniel Mack d663f1b1a9 sd-bus: sync kdbus.h (ABI break)
The KDBUS_CMD_FREE ioctl now uses a struct rather than a direct pointer
to the offset to free.

The KDBUS_CMD_MSG_CANCEL ioctl has also changes, but there's no user of
it yet in systemd.
2014-10-06 18:36:16 +02:00
Daniel Mack 995a1063db sd-bus: sync kdbus.h (ABI break!)
struct kdbus_cmd_match got a flags field, which systemd currently makes no
use of.
2014-10-02 17:15:39 +02:00
Daniel Mack 581fe6c817 sd-bus: sync kdbus.h (ABI break)
struct kdbus_cmd_conn_info takes a list of items now instead of a string.

Fix the only user in SD of that ioctl.
2014-10-02 13:04:04 +02:00
David Herrmann 8bf4a42a2e bus: sync kdbus.h (ABI break!) 2014-09-29 15:37:31 +02:00
Daniel Mack 590889ac53 sd-bus: sync kdbus.h 2014-09-23 17:37:44 +02:00
Daniel Mack 619d7a039f sd-bus: sync kdbus.h (API break)
Just a rename of two struct members to make the header file c++ compatible.
2014-09-23 16:16:04 +02:00
Daniel Mack f8c2425287 sd-bus: sync kdbus.h (API+ABI break)
The kdbus logic name registry logic was changed to transport the actual
name to acquire, release or report in a kdbus item.

This brings the name API a little more in line with other calls, and allows
for later augmentation.

Follow that change on the systemd side.
2014-09-22 18:22:53 +02:00
Daniel Mack 913b6d70cb sd-bus: sync kdbus.h
(no API/ABI break this time)
2014-09-18 10:25:38 +02:00
Ruben Kerkhof 06b643e7f5 Fix a few more typos 2014-08-30 13:46:07 -04:00
Daniel Mack a6082d778e kdbus: switch over to generic memfd implementation (ABI+API break) 2014-08-17 21:47:00 +02:00
Daniel Mack 15aa9b201c sd-bus: sync kdbus.h (ABI break) 2014-08-10 21:46:45 +02:00
Kay Sievers e90b8642cd kdbus: update header 2014-07-31 23:08:44 +02:00
Kay Sievers 1d49b5aea9 bus: update kdbus.h 2014-04-24 10:36:19 +02:00
Kay Sievers 26e376bfe3 bus: remove "on behalf" kdbus logic (ABI break) 2014-04-22 22:52:19 +02:00
Kay Sievers dec51b29f9 bus: update kdbus.h 2014-04-10 13:02:35 -07:00
Lennart Poettering f9d12d4439 update kdbus.h 2014-03-19 01:35:52 +01:00
Daniel Mack 088b51107a sd-bus: sync kdbus.h 2014-03-08 18:22:44 +01:00
Daniel Mack f7c7cd03d1 sd-bus: sync kdbus.h (ABI break)
Bring kdbus.h in sync with recent policy related changes. Most notably,
KDBUS_MAKE_POLICY_OPEN is now gone. The rest doesn't matter for systemd
at this point, as the policy functionality was not yet used.
2014-03-07 19:14:05 +01:00