On Tue, Dec 31, 2024 at 02:52:53PM +0100, Samuel Thibault wrote: > Samuel Thibault, le mar. 31 déc. 2024 14:36:02 +0100, a ecrit: > > > I'm not sure how to fix it. Should the expectations of GLib be updated > > > to be aligned? Like below: > > > > > > - if (size != G_CREDENTIALS_NATIVE_SIZE) > > > + if (size != CMSG_ALIGN(G_CREDENTIALS_NATIVE_SIZE)) > > > > > > Or should the macros be updated to use a 4 bytes size_t equivalent? > > > > I'd rather say it's our socket layer which is aligning cmsg_len while > > it shouldn't, since it's CMSG_NXTHDR that aligns it to get to the next > > header. > > Or perhaps it's glib itself that does the rounding, see > > ./gio/gsocket.c: cmsg->cmsg_len = CMSG_LEN > (g_socket_control_message_get_size (_message->control_messages[i])); >
This is OK, according to `man cmsg` > Adding CMSG_ALIGN to the glib size check seems odd to be because in the > linux case G_CREDENTIALS_NATIVE_SIZE is sizeof (struct ucred), which is > 12bytes, so not 8byte-round and rounding would break the check on Linux. > > You should probably check precisely the difference between Linux and > Hurd on these alignment questions at the various stages. > Ok, I'll have a look in both OSes behaviour.