Products › lamco-dbus-tools › Docs
How far each D-Bus debugging command intrudes: The eight layers
How far each D-Bus debugging command intrudes: The eight layers of lamco-dbus-tools, from reading files to the kernel, and which program may do what.
Describes version 0.4.1. The README lists every command and what it does.
Looking at a bus isn't free, and some ways of looking change what's being looked at. The toolkit sorts everything it can do into eight layers by how much each intrudes, and confines each program to its layers by what the program contains. A watching program can't inject by accident, because the code isn't in it.
| Layer | Name | What happens | What it costs or changes |
|---|---|---|---|
| 0 | Files | Policy files, service files, units and sandbox metadata are read | Nothing |
| 1 | Ask the bus | The bus is asked about itself: Names, owners, each connection's process | One connection, visible to programs that watch arrivals. Nothing is started |
| 2 | Listen | The tool becomes a monitor | The bus copies each matching message to it, which costs the bus work. See doing no harm |
| 3 | Ask a service | A running service is called, with the flag that forbids starting anything | The service does work to answer |
| 4 | Wake | A call is made that may start a service | A service starts that wasn't running |
| 5 | Drive | State is changed, a recording is replayed, load is generated | The machine's state changes |
| 6 | Interpose | A relay or proxy is put between one program and the bus | The bus sees the relay, not the program, which changes how permission checks identify it |
| 7 | Kernel | Hooks below the bus | Needs two capabilities, CAP_BPF and CAP_PERFMON; every local stream socket on the machine passes the hooks, at a cost measured in docs/measurements/stage-11/ |
Which program may do what
| Program | Layers |
|---|---|
dbussee |
0 to 3 |
dbusdo |
4 to 6 |
dbustell |
None. It reads stored recordings |
dbuskeep |
1 and 2, and 7 for dbuskeep kernel |
dbussee-monitor |
2 |
Why layer 1 and layer 3 are different
Asking the bus who owns a name is answered by the bus itself. Asking a service to describe itself is
answered by the service, and by default D-Bus starts a service that isn't running in order to deliver the
question. Measured on a private bus: busctl introspect, busctl tree, busctl get-property and a plain
call all started a stopped service. Questions to the bus itself started nothing.
So everything a watching command sends carries the flag that forbids starting, and a service that isn't running is reported as "not examined", never as "absent".
Never upward silently
A command doesn't climb a layer on its own. Where more could be learned by starting a service, the command says so and stops, and a flag is needed to go on. Each command's help entry states its layer.