-
Notifications
You must be signed in to change notification settings - Fork 8
[freebsd] basuctl status
default PID of system bus is off-by-one
#39
Comments
basuctl status
is off-by-one with default PID of system busbasuctl status
default PID system bus is off-by-one
basuctl status
default PID system bus is off-by-onebasuctl status
default PID of system bus is off-by-one
Does it happen on FreeBSD 13 too? Can you try to verify what this is returning in your case? Line 45 in 928a746
|
Yep, confirmed inside 13.0 amd64 jail on -CURRENT kernel. I only dogfood -CURRENT and can't easily test older kernels.
1233 aka invalid PID that's 1 digit smaller than system dbus daemon uses: (lldb) p cred
(xucred) $1 = {
cr_version = 0
cr_uid = 0
cr_ngroups = 1
cr_groups = {
[0] = 0
[1] = 0
[2] = 0
[3] = 0
[4] = 0
[5] = 0
[6] = 0
[7] = 0
[8] = 0
[9] = 0
[10] = 0
[11] = 0
[12] = 0
[13] = 0
[14] = 0
[15] = 0
}
= (_cr_unused1 = 0x00000000000005b6, cr_pid = 1233)
} Buggy
|
Hmm, if that's immediately after the call to LOCAL_PEERCRED, it would have to be either a buggy result or a wrong fd we're querying (not sure why that would be). I can try to poke at it a bit later. The freshports libwayland-server doesn't use cr_pid on freebsd 12 btw - https://cgit.freebsd.org/ports/tree/graphics/wayland/files/patch-src_wayland-server.c#n88 |
fd looks correct but PID maybe stale if dbus-daemon forked after listen call.
unix(4) says "the credentials presented to the client (the connect(2) caller) are those of the server when it called listen(2)". |
Hmm, that's a problem and means we can't use I would also argue that the behavior of LOCAL_PEERCRED here may be semi-broken, as I can't the value in reporting the pid of a process that may no longer exist if daemonization has occurred after If things worked on older FreeBSD, it may mean that we can just ignore cr_pid and report an invalid pid. |
(Alternatively, it may be that the behavior of the dbus server itself should be considered broken on freebsd.) |
Can you check if #40 is a functioning workaround? To be able to retrieve the PID on FreeBSD, we'd need something that returns the PID of the peer at the time of |
No regressions:
$ basuctl status
BusAddress=unix:path=/var/run/dbus/system_bus_socket
BusScope=system
BusID=0123456789abcdef0123456789abcdef
-<27>(../src/busctl/busctl.c:1282) Failed to get credentials: No such process
+EUID=0
+EGID=0
+Unit=n/a
+Slice=n/a
+UserUnit=n/a
+UserSlice=n/a
+Session=n/a $ basuctl list before
NAME PID PROCESS USER CONNECTION UNIT SESSION DESCRIPTION
-org.freedesktop.DBus - - - - - - -
+org.freedesktop.DBus - - root - - - - |
Thank you for testing! |
On FreeBSD >= 12.3 basu uses
cr_pid
which returns PID that appears to be off-by-one.The text was updated successfully, but these errors were encountered: