d bus in the kernel
play

D-Bus in the Kernel FOSDEM 2014, Brussels, Belgium January 2014 - PowerPoint PPT Presentation

D-Bus in the Kernel FOSDEM 2014, Brussels, Belgium January 2014 D-Bus in the Kernel Who? Greg Kroah-Hartman, Daniel Mack, Lennart Poettering, Kay Sievers with help from Tejun Heo D-Bus in the Kernel Most newer OS designs started around


  1. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping D-Bus in the Kernel

  2. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown D-Bus in the Kernel

  3. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side D-Bus in the Kernel

  4. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side Activation is identical to activation of other services D-Bus in the Kernel

  5. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side Activation is identical to activation of other services Userspace is much simpler, no XML, . . . D-Bus in the Kernel

  6. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side Activation is identical to activation of other services Userspace is much simpler, no XML, . . . Priority queues, . . . D-Bus in the Kernel

  7. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side Activation is identical to activation of other services Userspace is much simpler, no XML, . . . Priority queues, . . . Race-free exit-on-idle for bus activated services D-Bus in the Kernel

  8. kdbus Suitable for large data (GiB!), zero-copy, optionally reusable It’s efficient (2 or fewer copies, 2 validations, 2 context switches per duplex methd call transaction) Credentials sent along are comprehensive (uid, pid, gid, selinux label, pid starttime, tid, comm, tid comm, argv, exe, cgroup, caps, audit, . . . ) Implicit timestamping Always available, from earliest boot to latest shutdown Open for LSMs to hook into from the kernel side Activation is identical to activation of other services Userspace is much simpler, no XML, . . . Priority queues, . . . Race-free exit-on-idle for bus activated services . . . D-Bus in the Kernel

  9. Overview D-Bus in the Kernel

  10. Overview Receiver buffers D-Bus in the Kernel

  11. Overview Receiver buffers Single copy to destination(s) D-Bus in the Kernel

  12. Overview Receiver buffers Single copy to destination(s) Method call windows D-Bus in the Kernel

  13. Overview Receiver buffers Single copy to destination(s) Method call windows Name registry D-Bus in the Kernel

  14. memfds D-Bus in the Kernel

  15. memfds File descriptors for memory regions D-Bus in the Kernel

  16. memfds File descriptors for memory regions Zero Copy! D-Bus in the Kernel

  17. memfds File descriptors for memory regions Zero Copy! Sealing D-Bus in the Kernel

  18. memfds File descriptors for memory regions Zero Copy! Sealing At 512K zero copy is faster than single copy D-Bus in the Kernel

  19. memfds File descriptors for memory regions Zero Copy! Sealing At 512K zero copy is faster than single copy (a bit like Android ashmem) D-Bus in the Kernel

  20. Signal Broadcasting D-Bus in the Kernel

  21. Signal Broadcasting Bloom Filters D-Bus in the Kernel

  22. Signal Broadcasting Bloom Filters Every broadcast message includes bloom filter (calculated by sender) that contains all supported matches, kernel will then simply check receiver bloom filter mask (calculated by receiver) against it. D-Bus in the Kernel

  23. Signal Broadcasting Bloom Filters Every broadcast message includes bloom filter (calculated by sender) that contains all supported matches, kernel will then simply check receiver bloom filter mask (calculated by receiver) against it. Bloom filter uses SipHash, but kernel doesn’t care D-Bus in the Kernel

  24. Policy: D-Bus in the Kernel

  25. Policy: No XML, only simple ACL policy attached to service names D-Bus in the Kernel

  26. Policy: No XML, only simple ACL policy attached to service names More fine-grained access control needs to be done in userspace, but it’s much easier D-Bus in the Kernel

  27. Policy: No XML, only simple ACL policy attached to service names More fine-grained access control needs to be done in userspace, but it’s much easier Use capability checks! D-Bus in the Kernel

  28. Policy: No XML, only simple ACL policy attached to service names More fine-grained access control needs to be done in userspace, but it’s much easier Use capability checks! PolicyKit D-Bus in the Kernel

  29. Differences in Userspace: D-Bus in the Kernel

  30. Differences in Userspace: GVariant used for marshalling (O(1) random access to struct and array fields) D-Bus in the Kernel

  31. Differences in Userspace: GVariant used for marshalling (O(1) random access to struct and array fields) Setup, activation, policy management, driver, proxy lives in systemd D-Bus in the Kernel

  32. Differences in Userspace: GVariant used for marshalling (O(1) random access to struct and array fields) Setup, activation, policy management, driver, proxy lives in systemd New libsystemd-bus client library: waaaaay nicer to use – but not portable to non-Linux D-Bus in the Kernel

  33. Proxy: provides compatibility with dbus1 sockets D-Bus in the Kernel

  34. Proxy: provides compatibility with dbus1 sockets Synthesizes obsolete AcquiredName, LostName, Hello messages D-Bus in the Kernel

  35. Proxy: provides compatibility with dbus1 sockets Synthesizes obsolete AcquiredName, LostName, Hello messages Implements XML policy D-Bus in the Kernel

  36. Proxy: provides compatibility with dbus1 sockets Synthesizes obsolete AcquiredName, LostName, Hello messages Implements XML policy Activated on demand, exits on idle D-Bus in the Kernel

  37. Proxy: provides compatibility with dbus1 sockets Synthesizes obsolete AcquiredName, LostName, Hello messages Implements XML policy Activated on demand, exits on idle Remarshals gvariant/dbus1 D-Bus in the Kernel

  38. Driver: translates driver method calls into ioctl calls D-Bus in the Kernel

  39. Driver: translates driver method calls into ioctl calls org.freedesktop.DBus pseudo-service is a real service on kdbus D-Bus in the Kernel

  40. Driver: translates driver method calls into ioctl calls org.freedesktop.DBus pseudo-service is a real service on kdbus Note that driver signals are synthesized on client side, so the driver only handles method calls D-Bus in the Kernel

  41. Driver: translates driver method calls into ioctl calls org.freedesktop.DBus pseudo-service is a real service on kdbus Note that driver signals are synthesized on client side, so the driver only handles method calls Activated on demand, exits on idle D-Bus in the Kernel

  42. Activation: new .busname unit type in systemd D-Bus in the Kernel

  43. Activation: new .busname unit type in systemd Identical to .socket unit types for socket activation D-Bus in the Kernel

  44. Activation: new .busname unit type in systemd Identical to .socket unit types for socket activation dbus1 bus activation files still supported, but only for clients connecting via the proxy D-Bus in the Kernel

  45. libsystemd-bus D-Bus in the Kernel

  46. libsystemd-bus New client library, designed to be easy to use D-Bus in the Kernel

  47. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux D-Bus in the Kernel

  48. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings D-Bus in the Kernel

  49. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager D-Bus in the Kernel

  50. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager Lots of convenience functions D-Bus in the Kernel

  51. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager Lots of convenience functions Focus on converting errno from/to bus errors D-Bus in the Kernel

  52. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager Lots of convenience functions Focus on converting errno from/to bus errors Connect to container, connect to remote D-Bus in the Kernel

  53. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager Lots of convenience functions Focus on converting errno from/to bus errors Connect to container, connect to remote Credentials include units, slices, sessions, . . . D-Bus in the Kernel

  54. libsystemd-bus New client library, designed to be easy to use Not portable to non-Linux Assemble and parse messages with format strings Handles introspection, signal dispatching, method vtables, properties, object manager Lots of convenience functions Focus on converting errno from/to bus errors Connect to container, connect to remote Credentials include units, slices, sessions, . . . It’s probably what you want to use when you hack on system level software, and up D-Bus in the Kernel

  55. Android binder D-Bus in the Kernel

  56. Android binder Some similar technical concepts, different semantics D-Bus in the Kernel

  57. Android binder Some similar technical concepts, different semantics No name registry, no broadcasts, no ordering D-Bus in the Kernel

  58. When? D-Bus in the Kernel

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend