Re: SYNC extension: misalignment of system counter structs?

Bart Massey <[email protected]> Fri, 7 Feb 2025 11:20:31 -0800
Newsgroups gmane.comp.freedesktop.xcb
Message-ID <CAA6gtp=bUc-o0sUQ4YywXXLWQyG7P74Kfr4r5hU5-92RpdV0=g@mail.gmail.com>
--000000000000d09c87062d9242ff
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Reading the ancient discussion on this, I think Peter Harris had the right
of it. It would probably be good to treat all protocol description structs
as packed, and add explicit pad fields in the protocol description to match
the protocol spec. It looks like modern C compilers support
__attribute__((__packed__)) structs pretty well? I'm not sure how much of
the protocol description would have to be touched, though. Is it just the
stuff in Uli Shlacter's excellent list?

The easy thing, of course, would be to just take Daniel Martin's fix to add
a packed attribute to protocol descriptions (assuming it works):
https://lists.freedesktop.org/archives/xcb/2012-December/008032.html

On Fri, Feb 7, 2025 at 9:05=E2=80=AFAM Alan Coopersmith <alan.coopersmith@o=
racle.com>
wrote:

> On 2/7/25 07:40, Uli Schlachter wrote:
> > Hi,
> >
> > Am 06.02.25 um 21:15 schrieb Alan Coopersmith:
> >> On 2/4/25 09:46, Daniel Neugebauer wrote:
> >>> It would be great if someone could confirm the issue. See [3] for a
> test
> >>> implementation incl. a local workaround. Is there anything I'm doing
> wrong on
> >>> my end?
> >
> > I can confirm the issue and I can add that it is known:
> >
> > https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/36
> > https://bugs.freedesktop.org/show_bug.cgi?id=3D23403
>
> Ah right, I had clearly forgotten all about this in the past 13 years.
>
> >> So while I can confirm, I don't know how to fix it.
> >
> > Alan from the past also has a test case for reproducing this. See
> bugs.fdo link
> > above. :-)
>
> Heh, and now that I've been reminded, I found that old test case, so now
> have
> two!  If only Alan from the past had actually come up with a real fix...
>
> --
>          -Alan Coopersmith-                 [email protected]
>           Oracle Solaris Engineering - https://blogs.oracle.com/solaris
>

--000000000000d09c87062d9242ff
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Reading the ancient discussion on this, I think Peter=
 Harris had the right of it. It would probably be good to treat all protoco=
l description structs as packed, and add explicit pad fields in the protoco=
l description to match the protocol spec. It looks like modern C compilers =
support __attribute__((__packed__)) structs pretty well? I&#39;m not sure h=
ow much of the protocol description would have to be touched, though. Is it=
 just the stuff in Uli Shlacter&#39;s excellent list?<br><br></div><div>The=
 easy thing, of course, would be to just take Daniel Martin&#39;s fix to ad=
d a packed attribute to protocol descriptions (assuming it works): <a href=
=3D"https://lists.freedesktop.org/archives/xcb/2012-December/008032.html">h=
ttps://lists.freedesktop.org/archives/xcb/2012-December/008032.html</a></di=
v></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr=
">On Fri, Feb 7, 2025 at 9:05=E2=80=AFAM Alan Coopersmith &lt;<a href=3D"ma=
ilto:[email protected]" target=3D"_blank">alan.coopersmith@oracle=
.com</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1=
ex">On 2/7/25 07:40, Uli Schlachter wrote:<br>
&gt; Hi,<br>
&gt; <br>
&gt; Am 06.02.25 um 21:15 schrieb Alan Coopersmith:<br>
&gt;&gt; On 2/4/25 09:46, Daniel Neugebauer wrote:<br>
&gt;&gt;&gt; It would be great if someone could confirm the issue. See [3] =
for a test <br>
&gt;&gt;&gt; implementation incl. a local workaround. Is there anything I&#=
39;m doing wrong on <br>
&gt;&gt;&gt; my end?<br>
&gt; <br>
&gt; I can confirm the issue and I can add that it is known:<br>
&gt; <br>
&gt; <a href=3D"https://gitlab.freedesktop.org/xorg/lib/libxcb/-/issues/36"=
 rel=3D"noreferrer" target=3D"_blank">https://gitlab.freedesktop.org/xorg/l=
ib/libxcb/-/issues/36</a><br>
&gt; <a href=3D"https://bugs.freedesktop.org/show_bug.cgi?id=3D23403" rel=
=3D"noreferrer" target=3D"_blank">https://bugs.freedesktop.org/show_bug.cgi=
?id=3D23403</a><br>
<br>
Ah right, I had clearly forgotten all about this in the past 13 years.<br>
<br>
&gt;&gt; So while I can confirm, I don&#39;t know how to fix it.<br>
&gt; <br>
&gt; Alan from the past also has a test case for reproducing this. See bugs=
.fdo link <br>
&gt; above. :-)<br>
<br>
Heh, and now that I&#39;ve been reminded, I found that old test case, so no=
w have<br>
two!=C2=A0 If only Alan from the past had actually come up with a real fix.=
..<br>
<br>
-- <br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0-Alan Coopersmith-=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href=3D"mailto:alan.coopersmith=
@oracle.com" target=3D"_blank">[email protected]</a><br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Oracle Solaris Engineering - <a href=3D"=
https://blogs.oracle.com/solaris" rel=3D"noreferrer" target=3D"_blank">http=
s://blogs.oracle.com/solaris</a><br>
</blockquote></div>

--000000000000d09c87062d9242ff--