[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [hurd-amd64] ibus test failures
From: |
Samuel Thibault |
Subject: |
Re: [hurd-amd64] ibus test failures |
Date: |
Wed, 1 Jan 2025 22:19:58 +0100 |
Diego Nieto Cid, le mer. 01 janv. 2025 21:03:23 +0000, a ecrit:
> On Wed, Jan 01, 2025 at 08:07:04PM +0000, Diego Nieto Cid wrote:
> > On Wed, Jan 01, 2025 at 06:51:47PM +0100, Samuel Thibault wrote:
> > > >
> > > > /* Structure used for storage of ancillary data object information.
> > > > */
> > > > struct cmsghdr
> > > > {
> > > > socklen_t cmsg_len; /* Length of data in cmsg_data plus
> > > > length
> > > > of cmsghdr structure. */
> > >
> > > That's the correct type according to posix:
> > >
> > > ./basedefs/sys_socket.h.html:<tt>socklen_t cmsg_len </tt> Data byte
> > > count, including the <b>cmsghdr</b>. <tt>
> > >
> >
> > Ok, but we are giving unaligned data pointers with the current
> > implementation
> > of CMSG_DATA.
>
> On the other hand, nothing says the pointer shall be aligned:
>
> CMSG_DATA(cmsg) [1]
>
> If the argument is a pointer to a cmsghdr structure, this macro
> shall return an unsigned character pointer to the data array
> associated with the cmsghdr structure.
But on various archs, unaligned 64b-value access will SIGBUS.
> [1]
> https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html
>
> and GLib computation is relying on undefined behaviour.
No, it's CMSG_DATA and CMSG_LEN which are incoherent. CMSG_LEN shouldn't
be aligning on size_t if CMSG_DATA was just using the __cmsg_data field.
The sys/socket.h header has to be fixed one way or the other. Better
align ourself on the BSD behavior.
Samuel