Hi, On Tue, Dec 31, 2024 at 02:52:53PM +0100, Samuel Thibault wrote: > > You should probably check precisely the difference between Linux and > Hurd on these alignment questions at the various stages. >
I placed a `g_message` call in `g_unix_credentials_message_deserialize` and on Linux it doesn't get triggered, it instead goes through `g_socket_get_credentials`: # GLib-GIO-DEBUG: Accepting "EXTERNAL" authentication # GLib-GIO-MESSAGE: [g_socket_get_credentials] optlen=12 # GLib-GIO-DEBUG: Authorizing peer with credentials: GCredentials:linux-ucred:pid=87865,uid=1000,gid=1000 It takes the branch where G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED and SO_PEERCRED is defined. This function gets called from gio/gdbusauth.c: _g_dbus_auth_run_server if G_CREDENTIALS_PREFER_MESSAGE_PASSING is not defined (which is the case on Linux). To summarize: On Linux ======== #define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1 #define G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED 1 #undef G_CREDENTIALS_PREFER_MESSAGE_PASSING g_socket_get_credentials is called which uses getsockopt and SO_PEERCRED On Hurd ======= #define G_CREDENTIALS_UNIX_CREDENTIALS_MESSAGE_SUPPORTED 1 #undef G_CREDENTIALS_SOCKET_GET_CREDENTIALS_SUPPORTED #define G_CREDENTIALS_PREFER_MESSAGE_PASSING 1 g_unix_connection_receive_credentials is called which in turn calls: - g_unix_connection_receive_credentials - g_socket_receive_message - g_socket_control_message_deserialize - g_unix_credentials_message_deserialize So, I went ahead and defined G_CREDENTIALS_PREFER_MESSAGE_PASSING on Linux and to my surprise it didn't fail :P Instead the correct size was being computed: # GLib-GIO-MESSAGE: [input_message_from_msghdr] level=1,type=2,len=28,extra=16 # GLib-GIO-MESSAGE: [input_message_from_msghdr] cmsg=0x7ff46d6c5d40,data=0x7ff46d6c5d50 # GLib-GIO-MESSAGE: [g_socket_control_message_deserialize] level=1, type=2, size=12 # GLib-GIO-MESSAGE: [g_unix_credentials_message_deserialize] size=12, native=12 It must be something we are doing wrong on our side. I'll apply the logging to my Hurd box and see what comes out.