[Xcb] Re: new SELinux protocol reply problem

Jamey Sharp jamey at minilop.net
Sat Feb 24 16:17:04 PST 2007

On Sat, Feb 24, 2007 at 11:06:00AM -0800, Barton C Massey wrote:
> Is there any reason XCB shouldn't accept short replies?  As
> near as I can tell, violating the protocol spec in this
> particular way shouldn't ought to hurt anything; JG
> apparently agrees?

X11 does not allow encoding replies shorter than 32 bytes without
padding, because the length of a reply in bytes is defined as
	32 + reply.length * 4

I think JG's comment was somewhat confusing as it was only completely
accurate for events and errors (exactly 32 bytes), not replies (at least
32 bytes). The historical reasons behind these protocol details are
always interesting though.

> There might be an efficiency issue, I guess, since I imagine we start
> with a 32-byte read now.

Actually, unlike Xlib, XCB does a 4kB read and then pulls stuff out of
its input buffer as needed; though I believe Xlib always begins with a
32-byte read, as you imagined.

> In message <20070224175415.GA30883 at id.minilop.net> you wrote:
> > More automated validation would be nice, but your XML
> > described a legitimate piece of X protocol that I don't
> > want to reject.
> Maybe we could reject this protocol unless some explicit
> "short-reply" attribute were set in the XML?  I doubt this
> will be the last time the problem occurs...

But nothing was wrong on the client side, so why would we reject it? The
server sent a length that didn't match the number of bytes it
transmitted, which is simply a server bug.

> > It's on the very first page of the X11 protocol specification. What
> > more documentation do you want?
> :-) It would be really helpful if there were a good X
> extension-writers' guide, rather than just wacky random bits
> of stuff lying around the internet and guesswork.  Is there
> any?

I think it's called "Keith Packard"...

When somebody builds server-side XCB, many of these difficulties will go
away, so we'll have a simpler system to document. I'd say that would be
a good time to write an extension-writers' guide.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20070224/399af251/attachment.pgp

More information about the Xcb mailing list